+ 1
Please can you tell me why it doesn't work ?
It output all the numbers before the number we want to output . N = int(input()) sum=0 for number in range(1,N+1): sum = sum+number some=+sum print (some)
6 Answers
+ 1
Do you want single output of 'some'?
Then just take out print statement from loop..
N = int(input())
sum=0
for number in range(1,N+1):
sum = sum+number
print (sum) #single variable is enough.
+ 2
Output all the numbers before <N> or output <sum> in each iteration?
What's variable <some> for anyways?
+ 2
Output <sum> in each iteration
Some is the sum of all the sums
+ 1
Jayakrishnađźđł it works thanks
+ 1
You are idented print in loop.
Take it out of loop.
And single variable is enough, as both works same..
You're welcome.. Programer F_K
+ 1
Looks like this has been solved, but I would recommend different variable namesâŠin English, âsomeâ and âsumâ sound identical. So to avoid confusion when reciting through your code, you may find it benefical to have different sounding variable names.
Keep up the good work! :)