Project -2 : Lets Play Rock(R) , Paper(P) and Scicessors(S) Game
So far you have learned
- input and output,
- if/elif/else statements,
- basic mathematics,
- casting as float and int.
You will need to create if statements (and probably nesting) to decide who has won, lost or if the game is a tie.
Make it fun and add emojis or epic comments as your players battle it out.
Keep it simple for you. Don't expect the user to type in the words rock, paper, scissors. Instead, encourage them to use R, P, or S.
print()
player1= input ("player1 choose between R , P & S: ")
player2= input ("player2 choose between R , P & S: ")
if player1 == player2 :
print ("it is a tie")
elif player1 == "R" and player2 == "P":
print("player2 is winner")
elif player1 == "R" and player2 == "S":
print("player1 is winner")
elif player1 == "P" and player2 == "S":
print("player2 is winner")
elif player1 == "P" and player2 == "R":
print("player1 is winner")
elif player1 == "S" and player2 == "R":
print("player2 is winner")
elif player1 == "S" and player2 == "P":
print("player1 is winner")
else:
print("Entered wrong letter")
Version-2
print("E P I C 🪨 📄 ✂️ B A T T L E ")
print()
print("Select your move (R, P or S)")
print()
player1Move = input("Player 1 > ")
print()
player2Move = input("Player 2 > ")
print()
if player1Move=="R":
if player2Move=="R":
print("You both picked Rock, draw!")
elif player2Move=="S":
print("Player1 smashed Player2's Scissors into dust with their Rock!")
elif player2Move=="P":
print("Player1's Rock is smothered by Player2's Paper!")
else:
print("Invalid Move Player 2!")
elif player1Move=="P":
if player2Move=="R":
print("Player2's Rock is smothered by Player1's Paper!")
elif player2Move=="S":
print("Player1's Paper is cut into tiny pieces by Player2's Scissors!")
print("Two bits of paper flap at each other. Dissapointing. Draw.")
else:
print("Invalid Move Player 2!")
elif player1Move=="S":
if player2Move=="R":
print("Player 2's Rock makes metal-dust out of Player1's Scissors")
elif player2Move=="S":
print("Ka-Shing! Scissors bounce off each other like a dodgy sword fight! Draw.")
elif player2Move=="P":
print("Player1's Scissors make confetti out of Player2's paper!")
else:
print("Invalid Move Player 2!")
else:
print("Invalid Move Player 1!")