+ 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.

3rd Dec 2021, 7:02 PM
Sebastiancode
3 odpowiedzi
+ 1
It's a maths formulae for finding sum of n consecutive numbers is n*(n+1)/2
3rd Dec 2021, 7:18 PM
Jayakrishna 🇮🇳
+ 1
I got it now, thanks 🤝
3rd Dec 2021, 7:34 PM
Sebastiancode