Skip to content

Commit 685fc35

Browse files
committed
Added Rock-Paper-Scissors game
1 parent b354154 commit 685fc35

File tree

5 files changed

+74
-3
lines changed

5 files changed

+74
-3
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.REPL.enableREPLSmartSend": false
3+
}

__pycache__/random.cpython-314.pyc

285 Bytes
Binary file not shown.

excercise_13.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
row1=['','','']
2+
row2=['','','']
3+
row3=['','','']
4+
matrix=[row1,row2,row3]
5+
print(f"{row1}\n{row2}\n{row3}")
6+
7+
position=input("enter a position where you want to hide money:")
8+
row_number=int(position[0])
9+
column_number=int(position[1])
10+
11+
row_selected=matrix[row_number-1]
12+
row_selected[column_number-1]="Amrata"
13+
print(f"{row1}\n{row2}\n{row3}")

excercise_6.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
number=int(input("enter number:"))
22
if(number%2==0):
3-
print("even")
3+
print("This is even number")
44
else:
5-
print("odd")
6-
print("enter correct number..!")
5+
print("This is odd number")

rock_paper_scissors.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import random
2+
rock = '''
3+
_______
4+
---' ____)
5+
(_)
6+
(_)
7+
()
8+
---.(_)
9+
'''
10+
paper = '''
11+
_______
12+
---' ___)___
13+
______)
14+
_______)
15+
_______)
16+
---.)
17+
'''
18+
scissors = '''
19+
_______
20+
---' ___)___
21+
______)
22+
__________)
23+
()
24+
---.(_)
25+
'''
26+
game_images=[rock,paper,scissors]
27+
user_choice=int(input("enter your choice(0 for rock,1 for paper,2 for scissors):"))
28+
29+
if user_choice >=3 or user_choice < 0:
30+
print("You entered invalid number,You lose")
31+
else:
32+
print("user_choice:",user_choice)
33+
print(game_images[user_choice])
34+
35+
computer_choice=random.randint(0,2)
36+
print("computer_choice:",computer_choice)
37+
print(game_images[computer_choice])
38+
39+
40+
41+
if computer_choice==user_choice:
42+
print("It's a drawn")
43+
44+
elif computer_choice==0 and user_choice==2:
45+
print("You Lose")
46+
47+
elif user_choice==0 and computer_choice==2:
48+
print("You Win")
49+
50+
elif computer_choice > user_choice:
51+
print("You Lose.")
52+
53+
elif user_choice>computer_choice:
54+
print("You Win")
55+
56+

0 commit comments

Comments
 (0)