0
Can someone help in the "Sum of Consecutive Numbers" project ?
3 Antworten
+ 3
The answer provided by 12345 is elegant & succinct, but may be a bit advanced for you to understand yet.
Might I suggest you review the section about creating a range, then the section about how for loops work well with ranges.
You should be able to create a range of numbers from 1 to N+1
Now, how to add them together?
Create a variable, maybe call it total and assign it a value of 0.
Then review the section about "in place" operators
If you get stuck, then post your attempt back here for assistance
PS: print(total)
+ 2
Please specify the language and show your attempt also
+ 2
print(sum(list(range(int(input())+1))))