+ 1

How could I write a python to calculate the sum from 1 to 10?

Print y=answer

21st Jan 2018, 9:42 PM
Xinjing
3 Antworten
+ 7
Why not try it yourself? Iif you get stuck post your code so we can help. (Hint: use a for loop)
21st Jan 2018, 9:58 PM
blackcat1111
blackcat1111 - avatar
+ 3
sum=0 for i in range(1,11): sum+=i print(sum) hope this helps :)
21st Jan 2018, 9:59 PM
Jared
Jared - avatar
0
print(sum(range(11)))
22nd Jan 2018, 12:01 PM
richard