The idea was to get a different response depending on whether they say "yes" or "no". To keep things simple, I tried using something along the lines of "if the user says they are ready, do this, or else just give an alternative output". Ignore "time.sleep", that's just to give a more conversational-style element by using delayed response, and "F1" and "F2" are just pre-defined strings containing tabs and new lines to help with the formatting.
- Code: Select all
time.sleep(1); response = raw_input("Are you ready?")
if (response == "yes" or "Yes" or "YES"):
time.sleep(2); print (F1 + "Alrighty then, let's begin!" + F2)
time.sleep(2); print (F1 + "Oh..." + F2)
The output is always "Alrighty then, let's begin!" no matter what I enter, so it would appear there's a problem with the "else" bit. I've had a look at several sources online, but I can't put my finger on where I've gone wrong here, so would anyone mind giving me a simplified explanation of how to use these effectively?
Bear in mind I'm almost completely new to programming!
P.S. I had a look at "elif" but decided that I should stick to this method for the time being... was I wrong?