-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
191 lines (146 loc) · 5.08 KB
/
main.py
File metadata and controls
191 lines (146 loc) · 5.08 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
import random
import time
decor1 = "="
decor1_amount = 32
loading_prog = "."
loading_prog_rand = random.randint(2, 3)
guesses = []
print(decor1 * decor1_amount)
print ("welcome to my simple trivia game")
print(decor1 * decor1_amount)
print("loading", end=" ")
for load in range(3):
time.sleep(1)
loading_prog = loading_prog * loading_prog_rand
print(loading_prog, end="", flush=True)
print("\n")
time.sleep(1)
# noinspection PyGlobalUndefined
def sport():
question_num = 0
global sport_score
sport_score = 0
loading_result_rand = random.randint(2, 3)
questions = ("How many players are on a basketball team on the court?: ",
"Which country invented basketball?: ",
"How many points is a touchdown worth in American football?: ",
"How many holes are in a standard golf round?: ",
"Which sport uses a puck?: ")
options = ("(A) 4, (B) 5, (C) 6, (D) 7: ",
"(A) USA, (B) UK, (C) Canada, (D) Australia: ",
"(A) 3, (B) 6, (C) 7, (D) 8: ",
"(A) 9, (B) 12, (C) 18, (D) 24: ",
"(A) Lacrosse, (B) Hockey, (C) Polo, (D) Curling: ")
answer = ("B", "C", "B", "C", "B")
for question in questions:
print(question)
for option in options[question_num]:
print(option, end="")
user_guess = input("\n").upper()
guesses.append(user_guess)
if user_guess == answer[question_num]:
sport_score += 1
print("CORRECT!")
else:
print("WRONG!")
question_num += 1
print("\n")
print("Culminating results")
for loading_result in range(3):
time.sleep(1)
loading_result = loading_prog * 1
print(loading_result, end="", flush=True)
time.sleep(1)
print("\n" * 2)
print("Your score:", sport_score)
print("\n")
time.sleep(1)
if sport_score == 5:
print("WOW! ALL QUESTIONS CORRECT!")
elif sport_score == 1:
print("You got 1 question correct!")
elif sport_score == 0:
print("You got 0 questions correct")
else:
print(f"You got {sport_score} questions correct!")
# noinspection PyGlobalUndefined
def science():
science_question_num = 0
global science_score
science_score = 0
loading_result_rand = random.randint(2, 3)
science_questions = ("What planet is closest to the sun?: ",
"What gas do plants absorb?: ",
"How many bones are in the human body?: ",
"What is the chemical symbol for gold?: ",
"What is the speed of light?: ")
science_options = ("(A) Venus, (B) Earth, (C) Mars, (D) Mercury: ",
"(A) Oxygen, (B) Nitrogen, (C) Carbon Dioxide, (D) Hydrogen: ",
"(A) 196, (B) 206, (C) 216, (D) 226: ",
"(A) Go, (B) Gd, (C) Gl, (D) Au: ",
"(A) 300,000 km/s, (B) 150,000 km/s, (C) 500,000 km/s, (D) 1,000,000 km/s: ")
science_answer = ("D", "C", "B", "D", "A")
for question in science_questions:
print(question)
for option in science_options[science_question_num]:
print(option, end="")
user_guess = input("\n").upper()
guesses.append(user_guess)
if user_guess == science_answer[science_question_num]:
science_score += 1
print("CORRECT!")
else:
print("WRONG!")
science_question_num += 1
print("\n")
print("Culminating results")
for loading_result in range(3):
time.sleep(1)
loading_result = loading_prog * loading_result_rand
print(loading_result, end="", flush=True)
time.sleep(1)
print("\n" * 2)
print("Your score:", science_score)
print("\n")
time.sleep(1)
if science_score == 5:
print("WOW! ALL QUESTIONS CORRECT!")
elif science_score == 1:
print("You got 1 question correct!")
elif science_score == 0:
print("You got 0 questions correct")
else:
print(f"You got {science_score} questions correct!")
sport()
time.sleep(1)
science_continue = input("Would you like to continue? (y/n): ").lower()
if science_continue == "y" or science_continue == "yes":
science()
time.sleep(1)
print("calulating final score...")
time.sleep(1)
print(sport_score + science_score)
time.sleep(1)
print("Thank you for playing my simple trivia game! come back again!")
time.sleep(1)
print("closing in", end=" ")
for closing in reversed(range(1, 4)):
time.sleep(1)
print(closing, end=" ", flush=True)
time.sleep(1)
exit()
elif science_continue == "n" or science_continue == "no":
final_score = sport_score
print("Calculating final score...")
time.sleep(1)
print("Your final score:", final_score)
print("Goodbye!")
time.sleep(1)
print("Thank you for playing my simple trivia game! come back again!")
time.sleep(1)
print("closing in", end=" ")
for closing in reversed(range(1, 4)):
time.sleep(1)
print(closing, end=" ", flush=True)
time.sleep(1)
exit()