Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Dodo
- #Nov 27, 2013
- #rps.py
- def rps():
- countp1=0 #initial score
- countp2=0 #initial score
- while countp1 < 2 or countp2 < 2: #run until best out of 3
- #enter player moves
- player1=raw_input("Player 1's Move:")
- player2=raw_input("Player 2's Move:")
- if player1 == "rock" and player2 =="rock":
- print "It's a Tie!"
- elif player1 =="rock" and player2=="scissors":
- print "Player 1 wins!"
- countp1=countp1+1 #add point to player 1
- elif player1=="rock" and player2=="paper":
- print "Player 2 wins!"
- countp2=countp2+1 #add point to player 2
- elif player1 == "paper" and player2 =="paper":
- print "It's a Tie!"
- elif player1 == "paper" and player2=="scissors":
- print "Player 2 wins!"
- countp2=countp2+1
- elif player1 == "paper" and player2=="rock":
- print "Player 1 wins!"
- countp1=countp1+1
- elif player1 == "scissors" and player2=="scissors":
- print "It's a Tie!"
- elif player1 == "scissors" and player2=="paper":
- print "Plyaer 1 wins!"
- countp1=countp1+1
- elif player1 == "scissors" and player2=="rock":
- print "Player 2 wins!"
- countp2=countp2+1
- else:
- print "Invalid input. You must choose rock, paper, or scissors"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement