MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / fetch_quiz_data

Function fetch_quiz_data

projects/Online Trivia/main.py:6–10  ·  view source on GitHub ↗
(amount=4, quiz_type="boolean")

Source from the content-addressed store, hash-verified

4
5
6def fetch_quiz_data(amount=4, quiz_type="boolean"):
7 url = f"https://opentdb.com/api.php?amount={amount}&type={quiz_type}"
8 response = requests.get(url)
9 data_json = response.json()
10 return data_json["results"]
11
12
13def check_answer(question, answer, score):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected