-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ&A.py
More file actions
84 lines (51 loc) · 1.8 KB
/
Q&A.py
File metadata and controls
84 lines (51 loc) · 1.8 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
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
from click import option
def new_game():
number_game = 1
score = 0
Guesses = []
for key in questions:
print(key)
for option in options[number_game - 1]:
print(option)
gusse = input("Enter A B C D ?? ").upper()
Guesses.append(gusse)
print("---------------")
score += check_answer(questions.get(key),gusse)
number_game += 1
display_score(score)
def check_answer(answer, gusse):
if answer == gusse:
print("***You answered correctly***")
return 1
else:
print("***You didn't answer correctly***")
return 0
def display_score(score):
print("youre score : " + str(int(score/len(questions) * 100)) + "%")
print("----------------------------")
print("Correct answers : ")
for key in questions:
print(key, end = " : ")
print(questions.get(key))
print()
def play_again():
play = input("You want to play again ? ").upper()
if play == "YES":
return True
questions = {
"Who is Mehrad hidden ? " : "A",
"The best song of Z BAZI ? " : "B",
"Who is the best composer ?" : "D",
"The biggest Persian rap concert ? " : "C"
}
options = [ ["A.Singer," , "B.Actor", "C.soccer player" , "D.Comdin"],
["A.Nakoni bavar," , "B.Tabestoon kotahe", "C.Yakh" , "D.Bache mahal"],
["A.Mahiyar," , "B.Sami low", "C.Catchy" , "D.Alireza JJ"],
["A.Moltafet," , "B.Paydar", "C.Z bazi" , "D.Wantonz"]
]
new_game()
while play_again() == True:
new_game()
play_again()
#this is a final a file of game
print("Goodbye")