Answer to Question #171352 in Python for sandeep

Question #171352


Abhinav and Anjali are playing Rock-Paper-Scissors game. Rock-Paper-Scissors is a hand game usually played between two people, in which each player simultaneously forms one of three shapes with an outstretched hand. These shapes are "rock", "paper" and "scissors". Based on the shapes the player chooses the outcome of the game is determined. A rock beats scissors, scissors beat paper by cutting it, and paper beats rock by covering it. If the same shape is chosen by both of the players, then it is tie. Write a program to decide the winner of each round of the game based on the shapes the players chose.Input


The first line of input will be one of the strings "Rock", "Paper", "Scissors", representing the shape chosen by Abhinav.


The output should either be "Abhinav Wins" or "Anjali Wins", based on the winner. If it is a tie, the output should be "Tie".




1
Expert's answer
2021-03-13T04:40:52-0500
Abhinav_choice = str(input ("Abhinav choice:"))
Anjali_choice = str (input ("Anjali choice:"))
if Abhinav_choice == Anjali_choice:
    print ("Tie")
elif Abhinav_choice == "Rock":
    if Anjali_choice == "Paper":
        print ("Player 2 wins")
    else
         print ("Player 1 wins")
elif Abhinav_choice == "Paper":
    if Anjali_choice == "Rock":
         print ("Player 1 wins")
    else:
         print ("Player 2 wins")
elif Anjali_choice == "Rock":
     print ("Player 2 wins")
else:
     print ("Player 1 wins")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS