1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 | import random player1=input('Select Rock, Paper, or Scissors :').lower() print("Player 1 selected:",player1) player2=random.choice(['Rock','Paper','Scissors']).lower() print("Player 2 selected:",player2) if player1=='rock' and player2=='paper': print("Player 2 Won !") elif player1=='paper' and player2=='scissors': print("Player 2 Won!") elif player1=='scissors' and player2=='rock': print("Player 2 Won !") elif player1==player2: print("It's A Tie !") else: print("Player 1 Won !") |
Output 1:
Select Rock, Paper, or Scissors :
rock
Player 1 selected: rock
Player 2 selected: paper
Player 2 Won !
Output 2:
Select Rock, Paper, or Scissors :
Paper
Player 1 selected: paper
Player 2 selected: scissors
Player 2 Won!
Output 3:
Select Rock, Paper, or Scissors :
Scissors
Player 1 selected: scissors
Player 2 selected: rock
Player 2 Won !
Output 4:
Select Rock, Paper, or Scissors :
paper
Player 1 selected: paper
Player 2 selected: paper
It's A Tie !
No comments:
Post a Comment