def getUserAmount():
while True:
amount = input("Enter amount: ")
try:
value = int(amount)
if value >= 0:
break
else:
print("Amount is negative, try again")
except ValueError:
print("Amount must be a number, try again")
return value
main()
# NOTE
# Found this on "stack overflow" (I didn't write the code) (Below is the link of the page)
# https://stackoverflow.com/questions/33112377/python-verifying-if-input-is-int-and-greater-than-0
def getUserAmount():
while True:
amount = input("Enter amount: ")
try:
value = int(amount)
if value >= 0:
break
else:
print("Amount is negative, try again")
except ValueError:
print("Amount must be a number, try again")
return value
main()
# NOTE
# Found this on "stack overflow" (I didn't write the code) (Below is the link of the page)
# https://stackoverflow.com/questions/33112377/python-verifying-if-input-is-int-and-greater-than-0
def getUserAmount():
while True:
amount = input("Enter amount: ")
try:
value = int(amount)
if value >= 0:
break
else:
print("Amount is negative, try again")
except ValueError:
print("Amount must be a number, try again")
return value
main()
# NOTE
# Found this on "stack overflow" (I didn't write the code) (Below is the link of the page)
# https://stackoverflow.com/questions/33112377/python-verifying-if-input-is-int-and-greater-than-0