print("Enter numbers one by one. Type 'X' to finish.") while True: user_input = input("Enter a number (or 'X' to finish): ") if user input.upper() = 'X': number = float(user_input) numbers.append(number) except ValueError: print("Please enter a valid number or 'X' to finish.") if numbers: total = sum(numbers) average = total / len(numbers) print(f"Total: {total:.2f}") print(f"Average: {average:.2f}") else: print("No numbers were entered.")