Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

ateije Group Title

I am trying to make my rps game less case-sensitive, if that makes sense. Can i use the keyword "or" to assign multiple values to a variable? For example: Choice1="rock" or "Rock" or "ROCK" Choice2="paper" or "Paper" or "PAPER" Choice3="scissors" or "Scissors" or "SCISSORS" if player1==Choice1 and player2==Choice1: print "Tie" This example ran fine when I used raw_input. However, when I use parameters it will not function as expected (it only works if I use an all lowercase example). Isn't using 'or' in this way analogous to giving alternate conditions to the if statement? Am I using the wrong keyword? thank you so much!

  • 4 months ago
  • 4 months ago

  • This Question is Closed
  1. rsmith6559 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    or is a comparison operator. if( this or that): do something. The string library has functions like to_upper() and to_lower() which is what you probably want.

    • 4 months ago
  2. P0sitr0n Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    just convert all input to lower case

    • 4 months ago
  3. P0sitr0n Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    in java its typically string.toLowerCase()

    • 4 months ago
  4. jtryon Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    You didn't say that what language that you are working in but the safe bet is just to convert to all lowercase.

    • 4 months ago
  5. P0sitr0n Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    btw or is usually || . and is usually &&

    • 4 months ago
  6. ateije Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Thank you all so much!

    • 4 months ago
    • Attachments:

See more questions >>>

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.