Python Forum
If 2nd input in the game is correct, replace with 1st input and loop the game
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
If 2nd input in the game is correct, replace with 1st input and loop the game
#11
Always happy to help Smile
Reply
#12
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}")
tylerdurdane likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  My first python game : Tic-Tac-Toe ForsakenDusk 7 37,745 Feb-25-2025, 02:06 PM
Last Post: from1991
  [PyGame] Problem when moving game window michael1789 17 13,127 Feb-11-2025, 09:54 AM
Last Post: alexjordan
Lightbulb (Series) Advanced Game Design Articles for Setting Up an Infinite Metagame Reactorcore 0 529 Dec-15-2024, 08:49 PM
Last Post: Reactorcore
  How to put my game loop into a function? temlotresid6 7 1,790 Oct-29-2024, 05:17 AM
Last Post: menator01
  [PyGame] Waiting screen until user input - PiBooth world90 4 3,369 Oct-08-2024, 07:52 AM
Last Post: DumbleJum
  [PyGame] Input is not defined Forno_Gamer 3 1,954 Sep-08-2024, 09:11 AM
Last Post: deanhystad
  [PyGame] When I hit the space bar from the home screen, it sends me to the game over screen JesusisKing 2 2,524 Jul-31-2024, 08:10 AM
Last Post: Mollycoddle
  [PyGame] little space invaders / breakout game flash77 0 1,271 Jul-24-2024, 08:56 PM
Last Post: flash77
  [PyGame] Game restart problem senka_25 4 2,763 Jun-24-2024, 09:49 PM
Last Post: AdamHensley
  Simple Game - Choice Based theor 4 7,677 May-22-2024, 01:17 PM
Last Post: alanbriggs

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020