forked from yubarajpoudel/python-learn-step-by-step
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhangman.py
More file actions
52 lines (46 loc) · 1.04 KB
/
hangman.py
File metadata and controls
52 lines (46 loc) · 1.04 KB
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
def firstWrong():
print("-------------")
print(" | |")
print(" | O")
print(" |")
print(" |")
print(" |")
print("--------")
def secondWrong():
print("-------------")
print(" | |")
print(" | O")
print(" | /|\\")
print(" | |")
print(" |")
print("--------")
def thirdWrong():
print("-------------")
print(" | |")
print(" | O")
print(" | /|\\")
print(" | / \\")
print(" |")
print("--------")
questionAnswer = [{'q':'what is spelling of python?','a':'python'},
{'q':'what is spelling of python?','a':'python'},
{'q':'what is spelling of python?','a':'python'},
{'q':'what is spelling of python?','a':'python'},
{'q':'what is spelling of python?','a':'python'}]
mistake = 0
for qa in questionAnswer:
if mistake == 3:
break
answer = input(qa['q'] + ": ")
if answer == qa['a']:
print("You made correct anwer")
else:
mistake +=1
if mistake == 1
firstWrong()
elif mistake == 2:
secondWrong()
else:
thirdWrong()
else:
print("game over")