Answers for "How do you sum consecutive numbers in Python?"

0

How do you sum consecutive numbers in Python?

N = int(input("Please input an integer: "))
i = 1
x = range(1, N + 1)
for i in x:
    nums = range(1, i + 1)
print(int(sum(nums)))
Posted by: Guest on April-16-2022

Code answers related to "How do you sum consecutive numbers in Python?"

Python Answers by Framework

Browse Popular Code Answers by Language