""" sum.py Write a function sum_1_to_n(n) that adds the integers 1 to n. Ask the user for n ; call this function ; output the result in class exercise , March 22. $ python sum.py What is n? 10 The sum of 1 to 10 is 55. Jim M """ def sum_1_to_n(n): """ return 1 + 2 + 3 + ... + n """ result = 0 for i in range(1, n+1): result = result + i return result def main(): number_string = input("What is n? ") number = int(number_string) answer = sum_1_to_n(number) print(f"The sum of 1 to {number} is {answer}.") main()