# Python: Rock, Paper, Scissors

Okay, so i saw a program that my friend made for Rock Paper Scissors and he challenged me to replicate it, i think i got most of it, but raw_input stopped working, also I’m trying this out on the first lesson i just deleted everything and wrote my own code, so if that has anything to do with it please let me know. Thanks!
<edit: i recently changed the code because of a useful reply by @ionatan and it works perfectly Thank You for your contribution! >

Here’s the code:

from time import sleep
from random import randint

# The following code prints the instructions:

print “Welcome to Rock, Paper, Scissors!”
print “”“To play the game you must choose either rock, paper, or scissors. The computer will then randomly generate either rock, paper, or scissors. If you beat the computer you win! “””
print “”
sleep(1)

# Now we get computer choice

def computer_choice():
chosen = randint(1,3)
return randint(1,3)

# Next we get the user’s choice and save it as user_choice

user_choice = raw_input("Rock, Paper, or Scissors? ")
def user_choice():
user_choice = raw_input("Which will you choose? ")
return user_choice
# Now we reassign the computer’s number as a new string to make things easier later on
if chosen == 1:
computer_choice = “Rock”
elif chosen == 2:
computer_choice = “Paper”
elif chosen == 3:
computer_choice = “Scissors”

#We print the computer’s choice
sleep(1)
print “The computer chose:”
print computer_choice
sleep(1)

# Now we compare the computer choice with the user choice to determine the result

if user_choice == “Rock” and computer_choice == “Rock”:
print “It was a draw, restart and try again”
elif user_choice == “Rock” and computer_choice == “Paper”:
print “Sorry, but you have lost”
elif user_choice == “Rock” and computer_choice == “Scissors”:
print “YOU WON!”
elif user_choice == “Paper” and computer_choice == “Rock”:
print “YOU WON!”
elif user_choice == “Paper” and computer_choice == “Paper”:
print “It was a draw, restart and try again”
elif user_choice == “Paper” and computer_choice == “Scissors”:
print “Sorry, but you have lost”
elif user_choice == “Scissors” and computer_choice == “Rock”:
print “Sorry, but you have lost”
elif user_choice == “Scissors” and computer_choice == “Scissors”:
print “It was a draw, restart and try again”
elif user_choice == “Scissors” and computer-choice == “Paper”:
print “YOU WON!”
else:
print “ERROR 591: INVALID INPUT”
print “”

# and we print a closing statement

sleep (1)
print “”
print “Thank you for playing Rock, Paper, Scissors. Goodbye!”

Can’t run that. Don’t know what “stopped working” means.

I find it a bit odd that you’d want to catch EOF errors, or even get them really (how are you using this), and far more odd still that in response to EOF, you define a function.

Sorry for not being clearer, by “stooped working” i meant that it would not allow me to type but it fixed itself when I copy and pasted all the code to a different code emulator, but if you want to give more advice please do!
I kept getting EOF errors so i just made an exception, usually I wouldn’t do half-fix the problem but i couldn’t find another way. I defined the variable in response to EOF’s so that i could make the code more compact. (don’t know if it really worked tho) lol