+ 1
can someone explain to me why the result code of the exercise "sum of consecutive numbers" in Python for Beginners?
This is the code: N = int(input()) nums = int(N*(N+1)/2) print(nums) I looked for it because I didn't understand it, and i still don't get it.
2 Antworten
+ 1
It's a maths formulae for finding sum of n consecutive numbers is n*(n+1)/2
+ 1
I got it now, thanks 🤝