# RPSLP.py - name = 0 elif name =="Spock" name = 1...

This preview shows page 1. Sign up to view the full content.

#Assignment 3 #Rock Paper Scissors Lizard Spock (Couldn't Help Myself) #Name: Brittany Wojciehowski import math import random def number_to_name(number): #Converting the integer names to their respective strings. if number == 0: number = "Rock" elif number == 1: number = "Spock" elif number == 2: number = "Paper" elif number == 3: number = "Lizard" elif number == 4: number = "scissors" return number PlayerOne_choice = input("Player 1, please type (R)rock, (P)aper, (s)issors, (L)izard, or (S)pock:") playerOne_choice = str(PlayerOne_choice) playerTwo_choice = input("Player 2, please type (R)rock, (P)aper, (s)issors, (L)izard, or (S)pock:") playerTwo_choice = str(playerTwo_choice) def name_to_number(name): #Converting the strings to integers if name == "Rock":
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: name = 0 elif name == "Spock": name = 1 elif name == "Paper": name = 2 elif name == "Lizard": name = 3 elif name == "scissors": name = 4 return name def rpsls(guess): playerOne_choice = name_to_number(playerOne_choice) playerTwo_choice = name_to_number(playerTwo_choice) difference = (playerOne_number - playerTwo_number) % 5 print ("Player 1 chooses", number_to_name(playerOne_choice)) print ("Player 2 chooses", number_to_name(playerTwo_choice)) if difference == 0: print ("Player 1 and Player 2 tie!") elif difference == 1: print ("Player 1 Wins!") elif difference == 2: print ("Player 1 Wins!") elif difference == 3: print ("Player 2 Wins!") elif difference == 4: print ("Player 2 Wins!") return ""...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern