mirror of
https://github.com/marcogll/molding_assesment.git
synced 2026-03-15 11:25:02 +00:00
Apply collapsible answer formatting to Medium and Advanced assessments, update n8n workflow schema, fix Basic assessment formatting errors, and validate all components
This commit is contained in:
35
add_marks_medium.py
Normal file
35
add_marks_medium.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import re
|
||||
|
||||
correct_indices = [2,3,2,2,1,3,3,2,2,1,3,2,2,2,3,2,2,2,2,1,1,2,2,2,1,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]
|
||||
|
||||
with open('questions/markdown/Medium_assesment.md', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
questions = re.split(r'(?=### \d+\.)', content)
|
||||
|
||||
new_questions = []
|
||||
|
||||
q_num = 0
|
||||
|
||||
for q in questions:
|
||||
if not q.strip():
|
||||
continue
|
||||
lines = q.split('\n')
|
||||
options = []
|
||||
in_options = False
|
||||
for i, line in enumerate(lines):
|
||||
if line.startswith('- '):
|
||||
if not in_options:
|
||||
in_options = True
|
||||
options.append(i)
|
||||
if q_num < len(correct_indices):
|
||||
correct_idx = correct_indices[q_num] - 1 # 0-based
|
||||
if correct_idx < len(options):
|
||||
lines[options[correct_idx]] += ' ✅'
|
||||
new_questions.append('\n'.join(lines))
|
||||
q_num += 1
|
||||
|
||||
new_content = ''.join(new_questions)
|
||||
|
||||
with open('questions/markdown/Medium_assesment.md', 'w', encoding='utf-8') as f:
|
||||
f.write(new_content)
|
||||
Reference in New Issue
Block a user