So I'm creating a small hangman game to practice my Python and before I code the "Y"
or "Yes"
conditional portion of my code I decided to test out the responses to make sure it takes in the user inputs correctly. Unfortunately when I enter "N"
or "No"
the code doesn't skip past the "Y"
or "Yes"
portion of my code and returns
"Welcome to a game of Hangman! Please type in Y or Yes to play or N or No to quit no Yay! I'm glad you decided to play! Hmm let me guess a word.................ok DONE! Please type in a letter or guess the word!"
....any ideas why it's not skipping the "Yes"
portion of the code?
import random
list_of_words = ["banana", "monster", "development", "anarchy", "congruence", "display", "algorithm"]
word_chosen = random.choice(list_of_words)
print("Welcome to a game of Hangman! ")
user_response = str(input("Please type in Y or Yes to play or N or No to quit ")).lower()
if user_response == 'y' or 'yes':
print("Yay! I'm glad you decided to play! Hmm let me guess a word.................ok DONE!")
letter_guess = str(input("Please type in a letter or guess the word! ")).lower()
elif user_response == 'n' or 'no':
print("Awww well come back next time if you'd like to play HANGMAN!!!! DUN DUN DUNNNN ")