Jun-05-2017, 03:07 AM
Probably the most convoluted way to find the average of a set of numbers in Python but here it is.
amount = int(input("Enter number of items: "))#Gets amount of numbers to be averaged q = "q" for x in range(1, amount):#This generates as many variables as there are numbers to be averaged q = str(x) + q q = list(q) for x in range(0, amount):#This sets each variable to the user's input q[x] = input("Enter number: ") sum = 0 for x in range(0, amount):#This finds the sum of all the numbers sum = int(q[x]) + sum average = sum / amount#This finds the average by dividing the sum and the total amount of numbers print(average)