Created
March 29, 2020 19:44
-
-
Save Deep18-03/c7f0a7c303674b5e1f9f063cfbf26750 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Q:-Make a two-player Rock-Paper-Scissors game. | |
(Hint: Ask for player plays (using input), compare them, print out a message of congratulations to the winner, | |
and ask if the players want to start a new game) | |
steps: | |
1.take input from two player | |
2.compare the input of both players | |
3.Remember the rules: | |
Rock beats scissors | |
Scissors beats paper | |
Paper beats rock | |
4.use nested if else | |
''' | |
def compare(player1,player2): | |
if player1==player2: | |
print("it's a tie") | |
elif player1=='rock': | |
if player2=='scissor': | |
print('player1 wins,rock') | |
else: | |
print('player2 wins,paper') | |
elif player1=='paper': | |
if player2=='rock': | |
print('player1 wins,paper') | |
else: | |
print('player2 wins,scissor') | |
elif player1=='scissor': | |
if player2 == 'paper': | |
print('player1 wins,scissor') | |
else: | |
print('player2 wins,rock') | |
while True: | |
play=input("want to pkay the game yes or no ") | |
if play!='yes': | |
break | |
player1=input('what is choice of player1 from rock,paper or scissor ') | |
player2=input('what is choice player2 rock,paper or scissor ') | |
compare(player1,player2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment