-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrockpaperandscissor.py
49 lines (41 loc) · 1.22 KB
/
rockpaperandscissor.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
42
43
44
45
46
47
48
49
# code by @moiibrahem
# The fisrt project in this repo
import random as rd
# the rules of the game
rules = ["rock", "paper", "scissor"]
a = rules[0]
b = rules[1]
c = rules[2]
# the choices that computer generating
computer = rd.choice(rules)
# the results will show after choose
result = ["YOU WIN", "YOU LOSE", "DRAW"]
print('''---THE RULES---
1. Write in small alphabets
2. Your choices [rocks, paper, scissor]
3. That's it!
''')
# your choice
choice = input("Write your choice: ")
# game gui haha jk :)
if choice != rules:
print("You: " + choice)
print("Computer: " + computer)
# the final result
if choice == a and computer == c:
print("The result: " + result[0])
elif choice == computer:
print("The result: " + result[2])
elif choice == b and computer == a:
print("The result: " + result[0])
elif choice == c and computer == b:
print("The result: " + result[0])
elif choice == a and computer == b:
print("The result: " + result[1])
elif choice == b and computer == c:
print("The result: " + result[1])
elif choice == c and computer == a:
print("The result: " + result[1])
# spelling mistakes maybe
else:
print("Wrong input! check THE RULES, please.")