#get a number from the keyboard while True: try: money = float(input("How much money do you have? eg 50.36")) #get something from the keyboard #if it is a valid number, check that it is greater than 0 if money<=0: print("Positive numbers only!") continue #return to the beginning of the loop else: break #break out of the loop except ValueError: #if the data entered is not a number print("Enter numbers only, try again.") #out of loop, we have a number, evaluate it if money > 10: print("Get a haircut") print("Buy a hat") print("End of program")