Guest User

Untitled

a guest
Feb 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. myPoints = 0
  2. computerPoints = 0
  3.  
  4. oldChoice = "cooperate"
  5.  
  6. while (True):
  7.    
  8.     computersChoice = oldChoice
  9.     yourChoice = raw_input("What is your choice? ")
  10.     print ""
  11.    
  12.     if (yourChoice == "betray"):
  13.         print "You have betrayed"
  14.  
  15.     elif (yourChoice == "exit"):
  16.         break
  17.  
  18.     else:
  19.         print "You have cooperated"
  20.  
  21.     if (computersChoice == "betray"):
  22.         print "The computer has betrayed you"
  23.  
  24.     else:
  25.         print "The computer has cooperated with you"
  26.  
  27.     if (computersChoice == "betray" and yourChoice == "betray"):
  28.         myPoints = myPoints + 1
  29.         computerPoints = computerPoints + 1
  30.     elif (computersChoice == "betray" and yourChoice == "cooperate"):
  31.         myPoints = myPoints + 0
  32.         computerPoints = computerPoints + 7
  33.     elif (computersChoice == "cooperate" and yourChoice == "betray"):
  34.         myPoints = myPoints + 7
  35.         computerPoints = computerPoints + 0
  36.     else:
  37.         myPoints = myPoints + 5
  38.         computerPoints = computerPoints + 5
  39.  
  40.     print ""
  41.     print "You have " + `myPoints` + " points"
  42.     print "The computer has " + `computerPoints` + " points"
  43.    
  44.     oldChoice = yourChoice
Add Comment
Please, Sign In to add comment