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
  Game "Fluppy bird" nastia_nadashkevich 1 224 Apr-19-2024, 08:45 PM
Last Post: deanhystad
  [PyGame] Waiting screen until user input - PiBooth world90 2 970 Apr-19-2024, 03:34 AM
Last Post: attractalderman
  [PyGame] adding mouse control to game flash77 2 255 Apr-08-2024, 06:52 PM
Last Post: flash77
  Isometric game pygame Tiled howardberger 1 627 Jan-31-2024, 10:01 PM
Last Post: deanhystad
  I want to add a bullet function to my game. how would i go about it? Iyjja 5 967 Jan-09-2024, 05:42 PM
Last Post: Iyjja
  GPS Points to map for game/simulator AvgPlum 2 1,967 Jun-22-2023, 06:38 PM
Last Post: marynetherton
  [PyGame] When I hit the space bar from the home screen, it sends me to the game over screen JesusisKing 1 1,012 Apr-30-2023, 10:11 PM
Last Post: deanhystad
  Laggy Game Movement game_slayer_99 12 4,413 Oct-05-2022, 11:34 AM
Last Post: metulburr
  can't get collision detection to work in platform game chairmanme0wme0w 10 3,830 Aug-19-2022, 03:51 PM
Last Post: deanhystad
  [PyGame] AI Techniques applied to a Game insignia47 1 1,507 Jun-17-2022, 05:25 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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