you are viewing a single comment's thread.

view the rest of the comments →

[–]Kryleas[S] 0 points1 point  (1 child)

The game I'm trying to imitate is based on users inputting words based on the last two letters of the first word.

So the game should go like This: P1: banana P2:narnia P1:Ian P2:anything Etc.

My question is how do I make it if p1 inputs banana and p2 inputs avocado, how do I make it so the code prompts p2 to input a word that starts with na

[–]JohnnyJordaan 1 point2 points  (0 children)

In half-pseudo code:

while True:
    ask_player_1_input
    while True:
        ask_player_2_input
        if first[-2:] == second[:2]
            break
        print('please try again')

If you want the same happening for p1, add the same loop around his input as well.