Skip to content

Instantly share code, notes, and snippets.

@offby1
Created June 1, 2015 04:45
Show Gist options
  • Select an option

  • Save offby1/168e6e88e4a54833a018 to your computer and use it in GitHub Desktop.

Select an option

Save offby1/168e6e88e4a54833a018 to your computer and use it in GitHub Desktop.
def number_to_name(number):
return _number_to_name[number]
def rpsls(player_choice):
# delete the following pass statement and fill in your code below
# print a blank line to separate consecutive games
print ""
# print out the message for the player's choice
print "Player chooses " + player_choice
# convert the player's choice to player_number using the function name_to_number()
player_number = name_to_number(player_choice)
# compute random guess for comp_number using random.randrange()
comp_number = random.randrange(4)
# convert comp_number to comp_choice using the function number_to_name()
comp_name = number_to_name(comp_number)
# print out the message for computer's choice
print "Computer chooses {}".format(comp_name
@offby1
Copy link
Copy Markdown
Author

offby1 commented Jun 1, 2015

python wat.py 

Player chooses rock
Computer chooses rock

Player chooses Spock
Computer chooses rock

Player chooses paper
Computer chooses lizard

Player chooses lizard
Computer chooses lizard

Player chooses scissors
Computer chooses paper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment