0

Write a python code of a program that asks the user to enter ten numbers then display the total

for i in range(10): i=int(input('enter the number: '))

28th Jul 2020, 7:44 PM
Suraiya Binte Akbar(Aaisha)
Suraiya Binte Akbar(Aaisha) - avatar
9 ответов
+ 2
sum up is missing🧐 add a variable sum and increase it in the loop.
28th Jul 2020, 7:54 PM
Oma Falk
Oma Falk - avatar
+ 2
Suraiya Binte Akbar(Aaisha) change the name of the variable i on the 3rd and 4th lines, if you don't do that, you're reassigning the counter variable i on the 2nd line, and that is one of the reasons why your code is not working. The other one is that you must replace the last '':'' by a parenthesis ;)
28th Jul 2020, 9:26 PM
Joseph
Joseph - avatar
+ 1
sum=0 for i in range(10): i=int(input('enter the number: ')) sum = sum + i print(sum)
29th Jul 2020, 2:40 AM
Jonas Anthony Ebora
Jonas Anthony Ebora - avatar
0
I did it but it didn’t show all the input numbers
28th Jul 2020, 7:59 PM
Suraiya Binte Akbar(Aaisha)
Suraiya Binte Akbar(Aaisha) - avatar
0
show it please
28th Jul 2020, 8:08 PM
Oma Falk
Oma Falk - avatar
0
sum=0 for i in range(10): i=int(input('enter the number: '): sum=sum+i
28th Jul 2020, 8:17 PM
Suraiya Binte Akbar(Aaisha)
Suraiya Binte Akbar(Aaisha) - avatar
29th Jul 2020, 9:29 AM
Suraiya Binte Akbar(Aaisha)
Suraiya Binte Akbar(Aaisha) - avatar
0
Welcome! Just a newbie here trying to learn Python
29th Jul 2020, 9:32 AM
Jonas Anthony Ebora
Jonas Anthony Ebora - avatar
0
sum=0 for i in range(10): i=int(input('enter the number: ')) sum = sum + i print(sum) In this way you will get desired answer
30th Jul 2020, 5:16 AM
Rohit Kumar Singh
Rohit Kumar Singh - avatar