Alright. As you can see I am "newbie" on the block. When I try approaching my professor for assistance she tells me to go to my book. But I digress. If I was able to use a while loop this would be more simplified. But our professor is asking us to use a FOR loop and we have to use 2 functions.
Alright, easy enough. but WAIT, theres more. So below is my code but unfortunately I am getting back the awful "
TypeError: 'module' object is not iterable
I am sure it is something I completely overlooking but any step in the right direction would be awesome. Thanks!
# get_values - takes one argument (a number) that indicates the length # of a list,gets the user input for a list of numbers, # and returns the list of numbers. Use a for loop. # do_analysis – takes one argument that is a list of numbers, # then calculates and displays the statistical data specified # by the problem. Hint: you may find built-in functions useful. import numbers def main (): # create empty list intro() numbers = get_values() get_values() do_analysis() input("press enter to continue.") # required def intro (): # explanation of program print ("This program will get 20 numbers from you.") print ("Once all numbers have been entered the program") print ("will then analyze the data and display lowest number,") print ("highest number, total, and average.") print ("Alright! Let's begin.") print ("-------------------------------------------------------") def get_values(): values = # get numbers and add to list for i in range(20): value =(int(input("Enter a number " + str(i + 1) + ": "))) values.append(value) return values def do_analysis (): print ("The lowest number is: ") + str(min(numbers)) print ("The highest number is: ") + str(max(numbers)) print("The sum the numbers is: ") + str(sum(numbers)) print ("The average the numbers is: ") + str(sum(numbers)/len(numbers))
Edited 3 Years Ago by booicu