-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_questions.py
More file actions
25 lines (20 loc) · 863 Bytes
/
generate_questions.py
File metadata and controls
25 lines (20 loc) · 863 Bytes
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
import json
def make_questions(level, start_id, prefix):
return [
{
"id": start_id + i,
"question": f"{prefix} Question {i+1}: What is Python concept {i+1}?",
"answer": f"{prefix} Answer {i+1}: This is the answer for Python concept {i+1}.",
"category": prefix.lower(),
"explanation": f"{prefix} Explanation {i+1}: Explanation for Python concept {i+1}."
}
for i in range(100)
]
data = {
"beginner": make_questions("beginner", 1, "Beginner"),
"intermediate": make_questions("intermediate", 101, "Intermediate"),
"advanced": make_questions("advanced", 201, "Advanced")
}
with open("data/questions.json", "w", encoding="utf-8") as f:
json.dump(data, f, indent=2, ensure_ascii=False)
print("Generated 100 questions for each level in data/questions.json")