#x = float(input("Enter a number: ")) #print("Twice your number is: ", x*2) # Works, but will crash with letters #x = input("Enter a number: ") #if x == "": # print("Nothing entered, defaulting to 8.2") # x = 8.2 #else: # x = float(x) #print("Twice your number is: ", x*2) # Another way: Catch the exception! x = input("Enter a number: ") try: x = float(x) except: print("Could not convert entry to float, using 8.2") x = 8.2 print("Twice your number is: ", x*2)