GRAND ASSIGNMENT - 1 Hand game
Hand game
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 second line of input will be the sting representing the shape chosen by Anjali..
Output
The output should either be "Abhinav Wins" or "Anjali Wins", based on the winner. If it is a tie, the output should be "Tie".
Explanation
For example, if player1 choice is rock and player2 choice is paper then output is "Player 2 wins"
Input
The first line of input will be one of the strings "Rock", "Paper", "Scissors", representing the shape chosen by Abhinav. The second line of input will be the sting representing the shape chosen by Anjali..
Output
The output should either be "Abhinav Wins" or "Anjali Wins", based on the winner. If it is a tie, the output should be "Tie".
Explanation
For example, if player1 choice is rock and player2 choice is paper then output is "Player 2 wins"
Sample Input 1Sample Output 1
Rock Paper
Anjali Wins
Sample Input 2Sample Output 2
Scissors Rock
Anjali Wins
code:
abhinav_input = input()
anjali_input = input()
if anjali_input == abhinav_input:
print("Tie")
elif anjali_input == "Paper" and abhinav_input == "Scissors":
print("Abhinav Wins")
elif abhinav_input == "Rock" and anjali_input=="Scissors":
print("Abhinav Wins")
else:
print("Anjali Wins")
Comments
Post a Comment