I must make a program where the user inputs several numbers and inputs a specific number to stop the inputting process and receive an average. It should detect that the user inputs specifically 1234567 and then display the average but it does not. How can i fix this?
def averages():
def Average(lst):
try:
return sum(lst)/len(lst)
except ZeroDivisionError:
return 0
nums=[]
while 1234567 not in nums:
nums.append(input("Please input numbers and type 1234567 when you wish to find the average if the numbers inputted"))
mean=Average(nums)
print(nums)
print(mean)
I expected it to detect the input 1234567 and then output the average of all the numbers that have been inputted. But when 1234567 is inputted it continues to ask for numbers.