Im fairly new to code and my input is messed up can someone help?
My input says it is not a number and i need to run it through a discount system it was working but i tried to implement a lottery system and it broke
This is happening because your
except is catching the error in your code. What you want to do is change line 22 to
It is bad practice to catch all exceptions with just a plain
except, try and figure out what the error you want to catch is (in this case
ValueError from converting an invalid string to a float) and just catch that one like this
try: num=float(input("number: ")) except ValueError: print("only numbers plz")