Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.65 KB | None | 0 0
  1. def winner(comp,user):
  2.     if(user == "Rock" or user == "rock"):
  3.         tie = "x"
  4.         if(comp == "Rock"):
  5.             tie = "true"
  6.         elif(comp == "Paper"):
  7.             return "Computer won with paper."
  8.         elif(comp == "Scissor"):
  9.             return "You smash the computer's scissors, you win!"
  10.  
  11.     elif(user == "Paper" or user == "paper"):
  12.         if(comp == "Rock"):
  13.             return "You cover the computer's paper, you win!"
  14.         elif(comp == "Paper"):
  15.             tie = "true"
  16.         elif(comp == "Scissor"):
  17.             return "The computer's scissors cut your paper, you lose."
  18.  
  19.     elif(user == "Scissors" or user == "scissors"):
  20.         if(comp == "Rock"):
  21.             return "The computer's rock smashes your scissors, you lose."
  22.         elif(comp == "Paper"):
  23.             return "You cut up the computer's paper, you win!"
  24.         elif(comp == "Scissor"):
  25.             tie = "true"
  26.     while(tie == "true"):
  27.         computer_choice = random.randint(1,3)
  28.         user_choice = raw_input("What do is your choice? ")
  29.         if(computer_choice == 1):
  30.             computer_choice = "Rock"
  31.         elif(computer_choice == 2):
  32.             computer_choice = "Paper"
  33.         elif(computer_choice == 3):
  34.             computer_choice = "Scissor"
  35.         print winner(computer_choice,user_choice)
  36.  
  37. import random
  38. computer_choice = random.randint(1,3)
  39. user_choice = raw_input("What do is your choice? ")
  40. if(computer_choice == 1):
  41.     computer_choice = "Rock"
  42. elif(computer_choice == 2):
  43.     computer_choice = "Paper"
  44. elif(computer_choice == 3):
  45.     computer_choice = "Scissor"
  46.  
  47. print winner(computer_choice,user_choice)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement