So I've used python enough to know that this is really simple code and there isn't really a reason that it shouldn't be working. Essentially, I call an input and the user inputs a day of the week, I haven't assigned functions to each day yet, so I tested the input with an 'else' command which tells you "Invalid input", and then recalls the input and asks you again. I tested it by entering something other than what I have defined, and it returns nothing. It should print out "Invalid input." and then re-ask, but it doesn't.
Am I missing something really subtle, or does Python not work properly in Sublime Text 3?
Note: I am writing in Python3, but I never assigned Sublime Text 3 to use that version, I just assumed that it would already interpret it in the latest version of Python - maybe that's my mistake and if so; please can someone tell me how to fix it.
Here's the code:
def ask_day():
day = input("What's the day today?: ")
if day == monday:
mon()
elif day == tuesday:
tue()
elif day == wednesday:
wed()
elif day == thursday:
thu()
elif day == friday:
fri()
elif day == saturday:
sat()
elif day == sunday:
sun()
else:
print("Invalid input. Enter a day of the week in lower-case.")
ask_day()
def ask_time():
time = input("Whats the current hour?: ")
def mon():
pass
ask_day()
ask_time()
And here's the output:
What's the day today?: something else
Like I said, it should re-ask me to enter a day, buuut... nothing. It doesn't end, it just gets stuck.
Fun sidenote: Stop harassing this question, I only asked lol.