1_integer_sum moduleΒΆ
Sum of Integers Up To nΒΆ
Write a function, add_it_up(), that takes a single positive
integer as input and returns the sum of the integers from zero
to the input parameter included.
The function should return 0 if a non-integer is passed in.
-
1_integer_sum.add_it_up(integer: int) → int[source]ΒΆ Sum all the integers from
0tointeger.integermust be a positive integer number, otherwise0is returned.- Parameters
integer (int) β positive integer number.
- Returns
sum of all positive integers up to
integerincluded;0ifintegeris not a positive integer.