May-19-2023, 11:19 AM
Instead of checking for "done", check if len(inp) == 0 or if inp == "". Now you just print <Enter> without entering a number to exit.
Or you could exit on any non-number input.
Or you could exit on any non-number input.
numbers = list() try: while True: numbers.append(float(input("Enter a number:"))) except ValueError: # Raised by float(str) when str is not a numeric string. print(f"Average{numbers} = {sum(numbers) / len(numbers)}")