Odd Triangle Row Sum
Odd numbers can be arranged into a neat triangle: the first row has one number, the second has two, the third has three, and so on. Write row_sum_odd_numbers, which takes a row number n and returns the sum of all numbers in that row. For example, row 2 contains 3 and 5, so its sum is 8.
Примеры
Ввод
1Вывод
1Ввод
2Вывод
8Ввод
13Вывод
2197Нужно реализовать
def row_sum_odd_numbers(n: int) -> int:
Теги
math
Logga in för att se historik över inskick
Logga inLogga in för att använda AI-mentorn
Logga inVisible tests
1
Input
1Expected
12
Input
2Expected
83
Input
13Expected
21974
Input
42Expected
740885
Input
5Expected
1256
Input
-100Expected
-1000000Focus radio
Paused · SomaFM · Fluid