+ 2
Can some help me with this
I am stuck at get the sum of the integers https://www.sololearn.com/post/1712452/?ref=app
8 Answers
+ 1
You can approach the task like this:
â get user input() and store it in a variable
â convert the input to in integer
â initialize a result variable with 0
â use range() function and a for-loop to iterate over the range
â in each iteration add the current number to the result variable
â after the loop, print the result variable
+ 1
âââ
â after the loop, print the result variable
âââ
If you need help with your code, please link your code so we can check on it.
+ 1
Unindent the last line with the print().
Currently your print is inside of the loop. For the task we need it outside of the loop.
You can link your code like this:
Go to Code section, click +, select the programming language, insert your code, save.
Come back to this thread, click +, Insert Code, sort for My Code Bits, select your code.
+ 1
Thanks đ
It works now
+ 1
Great! :)
0
Please do not put links in the tag section. Put the relevant programming language there.
You can put the link in the description.
0
It has been updated
0
But it is printing the sum of the numbers individually not the final sum only