I'm building a console-based bill reminder app as my first project and i'm having some trouble ensuring that the user will enter the proper data when it comes to floats
.
Based on the python 2.7 documentation and a few answers here on stackoverflow I've come up with the following solution, that is not working.
billAmnt = raw_input('How much is this bill?')
try:
float(billAmnt)
return True
except ValueError:
return False
This will either return True or False, I need to ask the user again if it's false or continue to the next section of code if it's true.
If there is a good explanation of this elsewhere and you want to point me in the right direction i'd be fine with that as well.
Thanks