Код: Выделить всё
n = int(input("Enter a positive integer: "))
total = sum(range(1, n + 1))
if n \< 1:
print("Please enter a number greater than 0")
else:
print ("the total of the numbers from 1 to the one you entered is:",total)
Подробнее здесь: https://stackoverflow.com/questions/793 ... d-response