import statistics numbers = [] while True: num = input("Enter a number or type x to exit: ") if num.lower() == 'x': break else: numbers.append(int(num)) if numbers: print("Your average is:", statistics.mean(numbers)) else: print("No numbers were entered.")