# -*- coding: utf-8 -*- """ Created on Wed Sep 7 11:05:36 2022 @author: cpresser """ #name = input("Enter your name: ") #print(name) #from last time n = 1 sum = 0 # sum of integers 1..100 while n <= 100: sum = sum + n n = n + 1 print(sum) #adding to a string n = 1 line = "" #empty string while n < 10: line = line + "-" + str(n) #convert n to a string n = n + 1 #step #print(line) print(line) # ask the user for a number 4 times # print the sum of those numbers # 1. Start with making a loop that iterates 4 times # print n # 2. Calculate the sum of those values # 3. Ask the user for input # 4. Add the user input to the sum instead # 5. Ask the user how many n = 1 sum = 0 total_numbers = input("How many numbers? ") total_numbers = int(total_numbers) #convert to int while n <= total_numbers: #print(n) value = input("Enter a number: ") sum = sum + int(value) n = n + 1 print(f"The sum is {sum}.") print(f"The average is {sum/total_numbers}.")