I\'m new to coding in python and I was filling out some code that required a number of inputs. One thing it asked for was for the program to perform an action if the user pr
EDIT:
what about something like this:
try:
coinN = input("Enter next coin: ")
if coinN.isdigit(): # checks whether coinN is a number
if coinN == "" and totalcoin == rand:
print("Congratulations. Your calculations were a success.")
if coinN == "" and totalcoin < rand:
print("I'm sorry. You only entered",totalcoin,"cents.")
else:
raise ValueError
except ValueError:
print("Invalid Input")
else:
totalcoin = totalcoin + int(coinN) # convert coinN to int for addition