100-plus-python-coding-problems-with-solutions icon indicating copy to clipboard operation
100-plus-python-coding-problems-with-solutions copied to clipboard

Update Rock-paper-scissor.md

Open Peyman2012 opened this issue 3 years ago • 0 comments

def get_winner(p1, p2): if p1 == p2: return "It's a tie!"

elif p1 == 'rock': if p2 == 'scissors': return "First player wins!" else: return "Second Player wins!" elif p1 == 'scissors': if p2 == 'paper': return "First player win!" else: return"Second player wins!" elif p1 == 'paper': if p2 == 'rock': return "First player wins!" else: return "Second player win!" else: return "Invalid input!" loop=True
while loop: player1 = input("First player: rock, paper or scissors: ") player2 = input("Second Player: rock, paper or scissors: ") if player1=='E' or player2=='e': loop= False print(get_winner(player1, player2))

Peyman2012 avatar May 17 '22 21:05 Peyman2012