Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

nkesw001

  • 2 years ago

Can anyone figure out where I am going wrong? player1 = raw_input ("Player 1 ?") player2 = raw_input ("Player 2 ?") if (player1 == 'rock' and player2 == 'scissors'): print "Player 1 wins." elif (player1 == 'rock' and player2 == 'rock'): print "Tie" elif (player1 == 'scissors' and player2 == 'paper'): print "Player 1 wins." elif (player2 == 'scissors' and player2 == 'scissors'): print "Tie" elif (player1 == 'paper' and player2 == 'paper'): print "Tie" elif (player1 == 'paper' and player2 == 'scissors'): print "Player 2 wins." elif (player1 == 'roc

  • This Question is Open
  1. nkesw001
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Sorry this is the actual code player1 = raw_input ("Player 1 ?") player2 = raw_input ("Player 2 ?") if (player1 == 'rock' and player2 == 'scissors'): print "Player 1 wins." elif (player1 == 'rock' and player2 == 'rock'): print "Tie" elif (player1 == 'scissors' and player2 == 'paper'): print "Player 1 wins." elif (player2 == 'scissors' and player2 == 'scissors'): print "Tie" elif (player1 == 'paper' and player2 == 'paper'): print "Tie" elif (player1 == 'paper' and player2 == 'scissors'): print "Player 2 wins." elif (player1 == 'rock'and player2 == 'paper'): print "Player 2 wins." elif (player1 == 'paper' and player2 == 'rock'): print "Player 2 wins." elif (player1 == 'scissors' and player2 == 'rock'): print "Player 2 wins." else: print "This is not a valid object selection."

  2. wio
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    What is happening?

  3. nkesw001
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    When I run the code and type in an input for player1 and player2.....no matter what the answers are, it always go straight to the else statement and prints "This is not a valid object selection." Hope this info helps. Thanks for the assistance!

  4. wio
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I ran it and it worked.

  5. nkesw001
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    really?

  6. nkesw001
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    maybe my complier is old?

  7. wio
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    try putting in 'rock' and 'rock' as inputs

  8. happybee
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    typos while you input may cause that such as Paper and paper etc.

  9. happybee
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    you should type paper exactly as in the logical comparison

  10. Tyler1992
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    add the lower function to your input ``` player1 = raw_input("Player 1? ").lower() player2 = raw_input("Player 2? ").lower() ``` this insures that your input is all lowercase since thats what you're using to test in your if statements. So if you entered Rock then it would change it to rock and then do comparisons on it.

  11. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy