'how to end code inside an if statement if a letter is typed? [duplicate]
hi i want to end the code if a letter is typed in Cost1 but im not sure how to do that i want it to be only a number in there. any help is appreciated.( the .isletter is just filler for an example)
Item1 = input("What item do you want to buy? ") # asking what item is
if Item1.isdigit():
exit("ERROR")
Cost1 = input("How much does this item cost? ") # asking cost of item
if Cost1.isletter():
exit("ERROR")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
