-
Notifications
You must be signed in to change notification settings - Fork 0
/
mainplay.py
109 lines (79 loc) · 3.1 KB
/
mainplay.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
def play():
p1name = input("player 1, Please enter your name :")
print ("JUST-A check i heared - ", p1name )
p2name = input("Player 2 , Please enter your name: ")
print ("Yes I know U wanna defeat "+p1name+" U r "+ p2name )
# variable for counting score.
pp1 = 0
pp2 = 0
# variable for counting turn
turn = 0
# keep looping
while True:
# choose() function calling
picked_word = choose()
# jumble() fucntion calling
qn = jumble(picked_word)
print("jumbled word is :", qn)
# checking turn is odd or even
if turn % 2 == 0:
# if turn no. is even
# player1 turn
print(p1name, 'Your Turn.')
ans = input("what is in your mind? ")
# checking ans is equal to picked_word or not
if ans == picked_word:
# incremented by 1
pp1 += 1
print('Your score is :', pp1)
turn += 1
else:
print("Better luck next time ..")
# player 2 turn
print(p2name, 'Your turn.')
ans = input('what is in your mind? ')
if ans == picked_word:
pp2 += 1
print("Your Score is :", pp2)
else:
print("Better luck next time...correct word is :", picked_word)
c = int(input("press 1 to continue and 0 to quit :"))
# checking the c is equal to 0 or not
# if c is equal to 0 then break out
# of the while loop o/w keep looping.
if c == 0:
# thank() function calling
thank(p1name, p2name, pp1, pp2)
break
else:
# if turn no. is odd
# player2 turn
print(p2name, 'Your turn.')
ans = input('what is in your mind? ')
if ans == picked_word:
pp2 += 1
print("Your Score is :", pp2)
turn += 1
else:
print("Better luck next time.. :")
print(p1name, 'Your turn.')
ans = input('what is in your mind? ')
if ans == picked_word:
pp1 += 1
print("Your Score is :", pp1)
else:
print("Better luck next time...correct word is :", picked_word)
c = int(input("press 1 to continue and 0 to quit :"))
if c == 0:
# thank() function calling
thank(p1name, p2name, pp1, pp2)
break
c = int(input("press 1 to continue and 0 to quit :"))
if c == 0:
# thank() function calling
thank(p1name, p2name, pp1, pp2)
break
# Driver code
if __name__ == '__main__':
# play() function calling
play()