When I use the function, def problem1_5(age)
, and instead of inputting a value for age, I run the code, it crashes. How can I improve the code so when I dont input any value for age, it doesn't crash
This is for an online course i am undertaking, and I've already tried putting in a if at the beginning of the code statement but it could be possible that I did it inaccurately.
def problem1_5(age):
if age < 7:
print ("have a glass of milk")
elif age < 21:
print ("have a coke")
else:
print ("Have a martini")
I expect, when I enter nothing, to take me to another line or maybe end the code, but it just crashes.