-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuizgame.py
373 lines (358 loc) · 17.5 KB
/
Quizgame.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
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
print("Welcome to Computer Quiz Game!")
player_name = input("Enter your name to Continue: ")
score = 0
categories = {
1: "Economics",
2: "General Knowledge",
3: "Sports",
4: "Entertainment",
5: "Tech",
6: "Politics",
}
def questions():
question_bank = {
"Economics": [
"What is inflation?",
"Who is the author of 'The Wealth of Nations'?",
"What is GDP?",
"What is the law of supply and demand?",
"Define fiscal policy.",
"What is a stock market index?",
"Explain the concept of opportunity cost.",
"What is a monopoly?",
"Define balance of trade.",
"What is a recession?",
"What is the purpose of central banks?",
"Explain the concept of elasticity in economics.",
"What is the difference between a debit card and a credit card?",
"Define Gross National Product (GNP).",
"What is the Phillips Curve?",
"Explain the multiplier effect in economics.",
"What is quantitative easing?",
"Define microeconomics and macroeconomics.",
"Explain the concept of diminishing marginal utility.",
"What is the World Bank?",
"Define oligopoly.",
"Explain the Laffer curve.",
"What is a trade deficit?",
"What is the role of the International Monetary Fund (IMF)?",
],
"General Knowledge": [
"Which planet is known as the 'Red Planet'?",
"What is the capital of France?",
"Who painted the Mona Lisa?",
"What is the largest ocean on Earth?",
"Who wrote 'Romeo and Juliet'?",
"What is the currency of Japan?",
"Who is known as the 'Father of Modern Physics'?",
"What is the largest mammal in the world?",
"Which mountain is the tallest in the world?",
"Who discovered penicillin?",
"What is the longest river in the world?",
"Who wrote 'To Kill a Mockingbird'?",
"What is the capital of Australia?",
"Who is the author of '1984'?",
"What is the largest desert in the world?",
"Who painted 'Starry Night'?",
"What is the speed of light?",
"Who developed the theory of relativity?",
"What is the currency of China?",
"Who is known as the 'Queen of Pop'?",
"What is the national flower of Japan?",
"Who wrote 'The Great Gatsby'?",
"What is the smallest prime number?",
"Who is the author of 'The Catcher in the Rye'?",
],
"Sports": [
"Who is the all-time leading scorer in NBA history?",
"In which year did the first modern Olympic Games take place?",
"Which country won the FIFA World Cup in 2018?",
"Who holds the record for the most home runs in Major League Baseball (MLB)?",
"Which athlete is known as 'The Fastest Man on Earth'?",
"What is the scoring system in tennis called?",
"Who won the most gold medals in a single Olympics?",
"Which country has won the most FIFA World Cup titles?",
"What is the nickname of the New York Yankees' stadium?",
"Who is considered the greatest boxer of all time?",
"Which country hosted the 2016 Summer Olympics?",
"Who won the Women's World Cup in 2019?",
"What is the distance of a marathon in kilometers?",
"Who won the 2021 UEFA Champions League?",
"Which sport is played at Augusta National Golf Club?",
"Who is the all-time leading goal scorer in the UEFA Champions League?",
"What is the Triple Crown in horse racing?",
"Who holds the record for the most Olympic gold medals in swimming?",
"Which country hosted the 2014 FIFA World Cup?",
"Who won the 2020 Super Bowl?",
"What is the longest race in Formula 1?",
"Who is the only athlete to win Olympic gold in the 100m and 200m sprints in three consecutive Olympics?",
"Which country won the most medals in the 2020 Tokyo Olympics?",
"Who is the current FIFA World Player of the Year?",
],
"Entertainment": [
"Who played the lead role in 'The Dark Knight'?",
"What is the highest-grossing film of all time?",
"Which band is known as the 'Fab Four'?",
"Who directed the movie 'Schindler's List'?",
"Who won the Academy Award for Best Actor in 2020?",
"What is the longest-running animated TV series?",
"Who is the creator of the 'Star Wars' franchise?",
"Which actress played Elle Woods in 'Legally Blonde'?",
"What is the highest-grossing animated film of all time?",
"Who wrote the play 'Romeo and Juliet'?",
"Which film won the Best Picture Oscar in 2021?",
"Who played Jack Dawson in 'Titanic'?",
"What is the name of the fictional wizarding school in 'Harry Potter'?",
"Who is the author of 'The Lord of the Rings'?",
"What is the name of James Bond's iconic car?",
"Who won the Nobel Prize in Literature in 2016?",
"In which film did Tom Hanks play Forrest Gump?",
"Who directed 'Jurassic Park'?",
"What is the name of the first 'Star Wars' movie released in 1977?",
"Who played Tony Stark in the Marvel Cinematic Universe?",
"What is the name of the main character in 'The Matrix'?",
"Who is the lead singer of Queen?",
"Which animated film features a clownfish named Nemo?",
"Who won the Nobel Prize in Physics in 2020?",
],
"Tech": [
"Who co-founded Microsoft with Bill Gates?",
"What does the acronym 'URL' stand for?",
"Which programming language is often used for machine learning?",
"What is the difference between HTTP and HTTPS?",
"Who is the CEO of Tesla and SpaceX?",
"What is the largest social media platform by users?",
"What does the acronym 'AI' stand for?",
"Which company developed the first commercial microprocessor?",
"What is the purpose of a VPN?",
"What is the programming language used to build Android apps?",
"Who is known as the 'father of the World Wide Web'?",
"What is the main function of a router in a computer network?",
"Which company developed the first personal computer?",
"What is the name of Apple's virtual assistant?",
"What is the purpose of HTML in web development?",
"Who is the co-founder of Google?",
"What is the difference between software and hardware?",
"What is the role of RAM in a computer?",
"What is the 'cloud' in cloud computing?",
"Which programming language is often used for web development?",
"What does the acronym 'ISP' stand for?",
"Who is the founder of Amazon?",
"What is open-source software?",
"What is the significance of Moore's Law in computing?",
],
"Politics": [
"Who is the current President of the United States?",
"What is the capital of Russia?",
"Who wrote 'The Communist Manifesto'?",
"What is the United Nations?",
"Who is the Prime Minister of the United Kingdom?",
"What is the European Union?",
"Who is the leader of North Korea?",
"What is the significance of the Monroe Doctrine?",
"Who is the Chancellor of Germany?",
"What is NATO?",
"Who is the President of France?",
"What is the electoral college in the United States?",
"Who is the leader of China?",
"What is the purpose of the G7?",
"Who is the Secretary-General of the United Nations?",
"What is the role of the International Criminal Court?",
"Who is the leader of Iran?",
"What is the difference between a democracy and a republic?",
"Who is the President of Brazil?",
"What is the role of the World Health Organization (WHO)?",
"Who is the leader of Saudi Arabia?",
"What is the significance of the Treaty of Versailles?",
"Who is the leader of Japan?",
"What is the role of the Supreme Court in the United States?",
"Who is the leader of India?",
],
}
return question_bank
def answers():
answer_bank = {
"Economics": [
"An increase in the general price level of goods and services.",
"Adam Smith.",
"Gross Domestic Product, the total value of all goods and services produced in a country.",
"The relationship between the availability of a good or service and the desire for it.",
"Government's use of taxation and spending policies to influence the economy.",
"A measure of a section of the stock market.",
"The value of the next best alternative when a decision is made.",
"A situation in which a single company or group owns all or nearly all of the market for a particular type of product or service.",
"The difference between a country's exports and imports.",
"A period of economic decline, typically measured by a decrease in GDP for two consecutive quarters.",
"They manage a country's money supply, set interest rates, and ensure the stability of the financial system.",
"A measure of how much the quantity demanded of a good responds to a change in price.",
"A card that deducts money from a designated checking account to pay for goods or services.",
"The total value of all goods and services produced by a country's residents in a specific time period.",
"A graphical representation showing the relationship between inflation and unemployment.",
"The idea that an initial amount of spending leads to a larger increase in national income and consumption.",
"A monetary policy tool used by central banks to increase the money supply.",
"The study of individual units within an economy, such as households and firms.",
"The study of the overall aspects and workings of a national economy.",
"The change in satisfaction or pleasure derived from consuming an additional unit of a good.",
"An international financial institution that provides loans and grants to the governments of poorer countries.",
"A market structure in which a small number of firms have the majority of market share.",
"A curve illustrating the relationship between tax rates and tax revenue.",
"When a country's imports exceed its exports, resulting in a negative balance of trade.",
"An international organization that aims to promote global monetary cooperation.",
],
"General Knowledge": [
"Mars.",
"Paris.",
"Leonardo da Vinci.",
"Pacific Ocean.",
"William Shakespeare.",
"Yen.",
"Albert Einstein.",
"Blue whale.",
"Mount Everest.",
"Alexander Fleming.",
"Nile River.",
"Harper Lee.",
"Canberra.",
"George Orwell.",
"Sahara Desert.",
"Vincent van Gogh.",
"299,792 kilometers per second.",
"Albert Einstein.",
"Yuan.",
"Madonna.",
"Cherry blossom.",
"F. Scott Fitzgerald.",
"Two.",
"J.D. Salinger.",
],
"Sports": [
"Kareem Abdul-Jabbar.",
"1896.",
"France.",
"Barry Bonds.",
"Usain Bolt.",
"Love, 15, 30, 40, game.",
"Michael Phelps.",
"Brazil.",
"Yankee Stadium.",
"Muhammad Ali.",
"Brazil.",
"United States.",
"42.195 kilometers (26.219 miles).",
"Chelsea FC.",
"Golf.",
"Cristiano Ronaldo.",
"Winning the Kentucky Derby, Preakness Stakes, and Belmont Stakes in horse racing.",
"Michael Phelps.",
"Brazil.",
"Kansas City Chiefs.",
"Monaco Grand Prix.",
"Usain Bolt.",
"United States.",
"Lionel Messi.",
],
"Entertainment": [
"Christian Bale.",
"Avatar.",
"The Beatles.",
"Steven Spielberg.",
"Joaquin Phoenix.",
"The Simpsons.",
"George Lucas.",
"Reese Witherspoon.",
"The Lion King.",
"William Shakespeare.",
"Nomadland.",
"Leonardo DiCaprio.",
"Hogwarts School of Witchcraft and Wizardry.",
"J.R.R. Tolkien.",
"Aston Martin.",
"Bob Dylan.",
"Forrest Gump.",
"Steven Spielberg.",
"Star Wars: Episode IV - A New Hope.",
"Robert Downey Jr.",
"Neo.",
"Freddie Mercury.",
"Finding Nemo.",
"Roger Penrose.",
],
"Tech": [
"Paul Allen.",
"Uniform Resource Locator.",
"Python.",
"HTTPS adds a layer of security through encryption, ensuring a secure connection for data transfer.",
"Elon Musk.",
"Facebook.",
"Artificial Intelligence.",
"Intel.",
"Virtual Private Network, used to create a secure connection over the internet.",
"Java.",
"Tim Berners-Lee.",
"Routes data between devices in a computer network.",
"IBM.",
"Siri.",
"Hypertext Markup Language, used for structuring content on the web.",
"Larry Page.",
"Software refers to the programs and applications that run on a computer, while hardware includes the physical components.",
"Random Access Memory, used for temporary storage of data that the CPU can quickly access.",
"Refers to the delivery of computing services, including storage, processing power, and software, over the internet.",
"JavaScript.",
"Internet Service Provider.",
"Jeff Bezos.",
"Software with a source code that anyone can inspect, modify, and enhance.",
"The observation that the number of transistors on a microchip doubles approximately every two years, leading to increased computing power.",
],
"Politics": [
"Joe Biden.",
"Moscow.",
"Karl Marx and Friedrich Engels.",
"An international organization founded in 1945 to promote peace, security, and cooperation among member countries.",
"Boris Johnson.",
"A political and economic union of member states that are located primarily in Europe.",
"Kim Jong-un.",
"A U.S. policy opposing European colonialism and interference in the Western Hemisphere.",
"Olaf Scholz.",
"North Atlantic Treaty Organization, a military alliance of North American and European countries.",
"Emmanuel Macron.",
"A system used in the United States to elect the President and Vice President.",
"Xi Jinping.",
"Group of Seven, an organization of major advanced economies.",
"António Guterres.",
"A permanent international court established to prosecute individuals for genocide, crimes against humanity, war crimes, and aggression.",
"Ayatollah Ali Khamenei.",
"A democracy involves direct participation of citizens in decision-making, while a republic relies on elected representatives.",
"Jair Bolsonaro.",
"To direct international health efforts within the United Nations' system.",
"King Salman bin Abdulaziz Al Saud.",
"Ended World War I and imposed heavy penalties on Germany.",
"Yoshihide Suga.",
"To interpret and apply the law, including the power of judicial review.",
"Narendra Modi.",
],
}
return answer_bank
def play_quiz(category):
print(f"Hey! {player_name} Let's Begin")
question_bank = questions()
answer_bank = answers()
questions_list = question_bank[category]
answers_list = answer_bank[category]
for i in range(len(questions_list)):
print(f"\nQuestion {i + 1}: {questions_list[i]}")
user_answer = input("Your Answer: ").strip().capitalize()
if user_answer == answers_list[i]:
print("Correct!")
global score
score += 1
else:
print(f"Wrong! The correct answer is: {answers_list[i]}")
print(f"\nEnd of the {categories[int(category)]} category. Your score: {score}/{len(questions_list)}")
print("\nChoose a category:")
for key, value in categories.items():
print(f"{key}. {value}")
selected_category = input("Enter the number corresponding to your chosen category: ")
if selected_category.isdigit() and 1 <= int(selected_category) <= 6:
play_quiz(categories[int(selected_category)])
else:
print("Invalid input. Please enter a number between 1 and 6.")