Created
June 1, 2015 04:45
-
-
Save offby1/168e6e88e4a54833a018 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Author
offby1
commented
Jun 1, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment