-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateSpecial.py
More file actions
43 lines (34 loc) · 1.05 KB
/
generateSpecial.py
File metadata and controls
43 lines (34 loc) · 1.05 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
import json
from pathlib import Path
def generate_count_on_test(output_dir="tests"):
bank = []
qid = 1
# Loop numbers 1–9
for base in range(1, 10):
for add in [1, 2, 3]:
# base + add
bank.append({
"id": qid,
"question": f"{base} + {add}",
"answer": str(base + add)
})
qid += 1
# add + base (both orders, like your Addition +3 example)
bank.append({
"id": qid,
"question": f"{add} + {base}",
"answer": str(add + base)
})
qid += 1
test_data = {
"test_name": "Count On Facts",
"test_subtitle": "",
"questions": bank
}
Path(output_dir).mkdir(parents=True, exist_ok=True)
filename = f"{output_dir}/count_on.json"
with open(filename, "w") as f:
json.dump(test_data, f, indent=4)
print(f"✅ Generated {filename} with {len(bank)} questions.")
if __name__ == "__main__":
generate_count_on_test()