0

I'm stuck at lesson 36 code project Python

Pls help, Question sum of consecutive numbers, N =int(input()) Result total sum from 0 to N Help pls!!!

24th May 2021, 6:07 AM
Will Lim
Will Lim - avatar
4 Réponses
+ 6
Will Lim Use range(1, N + 1) in for loop and add each number or just do this without loop sum = N * (N + 1) // 2
24th May 2021, 8:38 AM
A͢J
A͢J - avatar
+ 5
You can use either for-loop or the sum formula.
24th May 2021, 7:28 AM
Gordon
Gordon - avatar
+ 3
Will Lim In which language? How we would know?
24th May 2021, 6:08 AM
A͢J
A͢J - avatar
- 1
🅰🅹 🅐🅝🅐🅝🅣 Python, by checking his profile ;)
24th May 2021, 6:11 AM
visph
visph - avatar