Skip to content

Commit 77f061b

Browse files
authored
Create DOUBLE GAME USING PYTHON
WE CAN PLAY DOUBLE GAME USING PYTHON PROGRAMMING VER EASILY.
1 parent d99f6d6 commit 77f061b

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

DOUBLE GAME USING PYTHON

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#double game
2+
import string
3+
import random
4+
symbols=[]
5+
symbols=list(string.ascii_letters)
6+
card1=[0]*5
7+
card2=[0]*5
8+
pos1=random.randint(0,4)
9+
pos2=random.randint(0,4)
10+
print(pos1)
11+
print(pos2)
12+
#pos1 and pos2 are same symbol positions in card1 and card2 respectively
13+
samesymbol=random.choice(symbols)
14+
symbols.remove(samesymbol)
15+
if(pos1==pos2):
16+
card2[pos1]=samesymbol
17+
card1[pos1]=samesymbol
18+
else:
19+
card1[pos2]=samesymbol
20+
card2[pos1]=samesymbol
21+
card1[pos2]=random.choice(symbols)
22+
symbols.remove(card1[pos2])
23+
card2[pos1]=random.choice(symbols)
24+
symbols.remove(card2[pos1])
25+
i=0
26+
while(i<5):
27+
if(i!=pos1 and i!=pos2):
28+
alphabet1=random.choice(symbols)
29+
symbols.remove(alphabet1)
30+
alphabet2=random.choice(symbols)
31+
symbols.remove(alphabet2)
32+
card1[i]=alphabet1
33+
card2[i]=alphabet2
34+
i=i+1
35+
print(card1)
36+
print(card2)
37+
ch=input("spot the similar symbol:")
38+
if(ch==samesymbol):
39+
print("right spot")
40+
else:
41+
print("wrong spot")

0 commit comments

Comments
 (0)