+ 1
what's the right order ? thanks ! anybody can help me?
Rearrange the code to define a function that calculates the sum of all numbers from 0 to its argument. def sum(x): res += i for i in range(x): return res res = 0 Unlock
2 Answers
+ 1
def sum(x):
res = 0
for i in range(x):
res += i
return res