How to calculate average and range after input into list?

I need some help regarding calculating averages and ranges. I am using built-in functions such as sum(), len(), etc. and cannot seem to calculate the average or range. I am using it to write a small piece of code for fun but cannot seem to get it to work. any help is much appreciated. Thank you!

x = 1
number_list = []

while x == 1:
     input_number = input("PLease input an integer")
     if str.isdigit(input_number) == True:
         print("Please input a valid integer only.")
     continueornot = input("Would you like to continue adding data? PLease input 'Yes' to continue, and anything else to quit.")
     if continueornot == 'Yes':
        x = 1
            print("Here is the maximum number:", max(number_list))
            print("Here is the minimum number:", min(number_list))
            print("Here is the count:", len(number_list))
            print("Here is the average:" + sum(number_list) / len(number_list))
            print("Here is the range:", range(number_list))

Read more here:

Content Attribution

This content was originally published by anonymous at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: