Python, code isn't working, can you help me find the mistake please

Hey guys, for line 29 and 31 isn’t working for me. Can you help me out? Link to my code

1 Like

Hi @ajaxjumper78997,
What is the purpose of this and other similar lines of code that assign to a variable the same value that it already has?:

        player1_wins = player1_wins

It seems that instead you should be incrementing the value of the variable.

1 Like

Thx, I’ve realized my mistake

1 Like

There are other issues that need to be addressed as well. One of them is that in this line, you check the value of player2_wins but not the value of player1_wins:

while player2_wins != 3 and rounds != 10:
1 Like

For that line of code, it shows that there should be at least 3 round and up to 10. Heres my new code

1 Like

In your new code, you have some confusing names of variables:

user1_input_input_wins = 0
user2_input_wins = 0
1 Like

Ya, I just noticed that, thx for letting me know

1 Like

Also, this collects input from users without prompting them:

    player1 = input()
    player2 = input()

You could do this instead so that it becomes more obvious which player’s turn it is to supply input:

    player1 = input("Player 1: ")
    player2 = input("Player 2: ")
1 Like

Thx so much, It less confusing now

1 Like

Continue to check your program to make sure it works as you intended it. For example, enter a series of responses that should produce a winning game for each player, and a series that produces a tie game. Let us know how it works out. Thorough debugging should check a representative variety of different cases.

1 Like

Ok, I will show it to you after I’m done

2 Likes

Thanks. We look forward to seeing the result.

1 Like

Hey, when I input
P
r
r
p
s
p
r
s
Its not working, The expected output is Player1 wins after 4 rounds!

1 Like

The first of your inputs is an uppercase P. That would be invalid input, since it should be lowercase.

1 Like

nope, it still doesn’t work, Here’s my latest work

1 Like

This line can cause a problem:

while user2_wins != 3 and rounds != 10:

When Player2 has scored 3 wins, the game ends. However, when Player1 scores 3 wins, it does not end the game. Why is it different for the two players?

1 Like

This is what I’ve changed so far, now we got another problem
when I input
p p p r r r s s p p s s s s p p r p s p
Its not working

1 Like

Instead of this:

while user1_wins != 3 and user2_wins != 10:

… you probably should have this:

while user1_wins != 3 and user2_wins != 3 and rounds != 10:
1 Like

Thx, I have changed it, we got another problem when I input p p s s r r r s s r p s r p , the output shows Player1 wins after 6 rounds . The expected output is Player2 wins after 7 rounds!

1 Like

Could we have a link to the most recent version of the game?

1 Like