# Homework 18, challenge -- solution. n = int(input("Enter a positive whole number n: ")) total = 0 for i in range(1, n + 1): total = total + i print("Sum from 1 to " + str(n) + " is " + str(total)) print("Formula gives " + str(n * (n + 1) // 2))