Novice Pythoner here. I am trying to finish my first program (a tip calculator) and I have one last piece of code to write. Here is the part of code I need to add on to:
bill_amt = True
while bill_amt:
try:
bill_amt = float(input('First, what was the price of your meal?:'))
except:
print('Please enter a number only.')
continue
if bill_amt <= 0:
print('Your meal wasn\'t $',bill_amt,'! Please try again.')
bill_amt = True
else:
x = float(bill_amt)
bill_amt = False
What I want to do is add a command that will limit the amount of numbers you can input when the code asks how much your meal was so user can't type in 4511511513545513513518451.32. I've tried using len(bill_amt) > 8, but I get an error that floats don't have strings. How do I get around this? Thanks, sorry if it's a duplicate! -Pottsy
except ValueError:not justexceptif bill_amt > 99999.99:?