0

 Make a one line Python statement that uses both sum and range to print the sum of the numbers 1 through 10

Someone help me with this please

3rd May 2017, 9:03 PM
Tosin
4 Réponses
+ 6
Is this what you are looking for? print(sum(range(1, 10))) (if I understand 'through' properly - it means 'up to but not including', right?)
3rd May 2017, 9:12 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
Oh, then just change 10 to 11 and we're done :)
3rd May 2017, 9:30 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 1
Yeah that's what I did. My mistake was with the parentheses. Thanks again :)
3rd May 2017, 9:32 PM
Tosin
0
Thanks a lot Kuba. I think 10 should be included.
3rd May 2017, 9:29 PM
Tosin