Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

nkesw001

  • 9 months 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
    • 9 months 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
    • 9 months ago
    Best Response
    You've already chosen the best response.
    Medals 0

    What is happening?

  3. nkesw001
    • 9 months 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
    • 9 months ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I ran it and it worked.

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

    really?

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

    maybe my complier is old?

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

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

  8. happybee
    • 9 months 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
    • 9 months ago
    Best Response
    You've already chosen the best response.
    Medals 0

    you should type paper exactly as in the logical comparison

  10. Tyler1992
    • 9 months 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

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.