Python Forum

Full Version: If 2nd input in the game is correct, replace with 1st input and loop the game
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Always happy to help Smile
I would keep the word chain to report at the end of the game, or to compute a score.
words = [input('enter a country name: ')]
while True:
    word = input('enter a country name starts with the last letter of previous country name: ')
    if word and word[0].lower() == words[-1][-1].lower():
        words.append(word)
    else:
        break
print(f"So sorry, The first letter of {word} does not match the last letter of {words[-1]}.")
print(f"Your word chain {words}")
Pages: 1 2