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 pressed the enter key and did not type in any input. My question is how you would get python to check for that. Would it be:
if input == "":
#action
Or is it something else? Thank you for the help.
Edit: Here is what my code currently looks like for reference.
try:
coinN= int(input("Enter next coin: "))
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.")
except ValueError:
print("Invalid Input")
else:
totalcoin = totalcoin + coinN
==
s in there and change" "
to""
. – Frenchify