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
0
tointeger
.integer
must be a positive integer number, otherwise0
is returned.- Parameters
integer (int) β positive integer number.
- Returns
sum of all positive integers up to
integer
included;0
ifinteger
is not a positive integer.