Simple game in python
Question: I have looked at the other posts about this topic but still can not find what
I'm doing wrong at the beginning. Instead of rock, paper, and scissors, I am
using python, ruby, and java. It is not close to being done yet. I'm not into
the if loops yet for, but if the user inputs something different then
"python", "ruby", or Java", I want it too print "The game is over". I get an
error saying the string i entered is not defined. Could someone guide me in
the direction I need to go? I think I'm confused when comparing userInput to
gameList, since gameList is a list.

    
    
    import random
    def pythonRubyJava():
        gameList = ["python","ruby","java"]
        userInput = input("python, ruby, or java?:")
        randomInput = random.choice(gameList)
        if userInput != gameList:
            print "The game is over"
    

I got that part figured out. Do I need to store "python", "ruby", and "java"
as variables to continue now? Or where would you go?

    
    
    import random
    def pythonRubyJava():
        gameList = ["python","ruby","java"]
        userInput = raw_input("python, ruby, or java?:")
        randomInput = random.choice(gameList)
        print randomInput
        if userInput not in gameList:
            print "The game is over"
        if userInput == "python" and randomInput == "python":
            print "stalemate"
        if userInput == "ruby" and randomInput == "ruby":
            print "stalemate"
        if userInput == "java" and randomInput == "java":
            print "stalemate"        
    

Instead of getting the same answer, I want to be able to run the game again
and not have it print the stalemate to end the game, just start over. I know I
would have to delete "print "stalemate"" but I just wanted to show that.


Answer: The error occurs in line 4, which reads the user input. The problem is that
`input(...)` parses the expression after reading from command line, so strings
would have to be quoted.

Use `raw_input(...)` instead:

    
    
    userInput = raw_input("python, ruby, or java?:")
    

