I don't know why it doesn't work - Basic code on python
Hi folks... i am starting to learn python (first code language in my life), and i am trying to do this excercise: 5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter 7, 2, bob, 10, and 4 and match the output below. This is my code: list = [] largest = None smallest = None while True: num = input("Enter a number: ") if num == "done": break try: num == float(num) except: print("Invalid Input") continue list.append(num) print("Maximum", max(list)) print("Minimum", min(list)) And of course the answere must be: Invalid input Maximum is 10 Minimum is 2 but it doesnt work, it says that 10 is the minimum!!! xD Some helt to try to understand please. Thank u everyone!