[Solved] Python 3.4, add numbers up to an integer [duplicate]
About your code: if y == 1: return y elif y <= 1 and y <= 999999999: print(sum(y)) First, why are you using return in if part but using print() in elif part? Then, simply do something like this: def function_name(number): return sum(range(1, number+1)) Demo: For example, the number is 10: print(function_name(10)) Output: 55 range() … Read more