-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrock-paper-scissors.py
41 lines (34 loc) · 952 Bytes
/
rock-paper-scissors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Rock, Paper, Scissors Game - A simple rock paper scissors game
# Copyright (c) 2020 Ercan Ersoy
# This file licensed under MIT License.
from random import uniform
elements = ["rock", "paper", "scissors"]
print("1) Rock")
print("2) Paper")
print("3) Scissors")
print()
player_choice = int(input("Your choice: "))
computer_choice = int(uniform(1, 3))
print("Player's choice: ", end="")
print(elements[player_choice - 1])
print()
print("Computer's choice: ", end="")
print(elements[computer_choice - 1])
print()
if (player_choice == computer_choice):
print("This game is draw.")
elif (player_choice == 1):
if (computer_choice == 2):
print("You lose.")
else:
print("You win.")
elif (player_choice == 2):
if (computer_choice == 3):
print("You lose.")
else:
print("You win.")
elif (player_choice == 3):
if (computer_choice == 1):
print("You lose.")
else:
print("You win.")