Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def winner(comp,user):
- if(user == "Rock" or user == "rock"):
- tie = "x"
- if(comp == "Rock"):
- tie = "true"
- elif(comp == "Paper"):
- return "Computer won with paper."
- elif(comp == "Scissor"):
- return "You smash the computer's scissors, you win!"
- elif(user == "Paper" or user == "paper"):
- if(comp == "Rock"):
- return "You cover the computer's paper, you win!"
- elif(comp == "Paper"):
- tie = "true"
- elif(comp == "Scissor"):
- return "The computer's scissors cut your paper, you lose."
- elif(user == "Scissors" or user == "scissors"):
- if(comp == "Rock"):
- return "The computer's rock smashes your scissors, you lose."
- elif(comp == "Paper"):
- return "You cut up the computer's paper, you win!"
- elif(comp == "Scissor"):
- tie = "true"
- while(tie == "true"):
- computer_choice = random.randint(1,3)
- user_choice = raw_input("What do is your choice? ")
- if(computer_choice == 1):
- computer_choice = "Rock"
- elif(computer_choice == 2):
- computer_choice = "Paper"
- elif(computer_choice == 3):
- computer_choice = "Scissor"
- print winner(computer_choice,user_choice)
- import random
- computer_choice = random.randint(1,3)
- user_choice = raw_input("What do is your choice? ")
- if(computer_choice == 1):
- computer_choice = "Rock"
- elif(computer_choice == 2):
- computer_choice = "Paper"
- elif(computer_choice == 3):
- computer_choice = "Scissor"
- print winner(computer_choice,user_choice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement