I’m making a simple payment system and I want to validate the purchase amount the user inputs. So far all I’ve managed to do is prevent the user inputting 0 or 0.00:
‘’’
amount = float(input(“amount of payment: “))
While amount <= 0:
Print(“invalid input”)
amount = float(input(“amount of payment: “))
else:
Runs the rest of the system
What would be the best way to prevent the user inputting any letters or characters such as - or £ and pretty much only allow whole number or decimal places numbers. I have briefly tried to use regex but I can’t get it to work