Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myPoints = 0
- computerPoints = 0
- oldChoice = "cooperate"
- while (True):
- computersChoice = oldChoice
- yourChoice = raw_input("What is your choice? ")
- print ""
- if (yourChoice == "betray"):
- print "You have betrayed"
- elif (yourChoice == "exit"):
- break
- else:
- print "You have cooperated"
- if (computersChoice == "betray"):
- print "The computer has betrayed you"
- else:
- print "The computer has cooperated with you"
- if (computersChoice == "betray" and yourChoice == "betray"):
- myPoints = myPoints + 1
- computerPoints = computerPoints + 1
- elif (computersChoice == "betray" and yourChoice == "cooperate"):
- myPoints = myPoints + 0
- computerPoints = computerPoints + 7
- elif (computersChoice == "cooperate" and yourChoice == "betray"):
- myPoints = myPoints + 7
- computerPoints = computerPoints + 0
- else:
- myPoints = myPoints + 5
- computerPoints = computerPoints + 5
- print ""
- print "You have " + `myPoints` + " points"
- print "The computer has " + `computerPoints` + " points"
- oldChoice = yourChoice
Add Comment
Please, Sign In to add comment