Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -40,16 +40,16 @@ def parse_questions(file_path):
|
|
40 |
return questions
|
41 |
|
42 |
# Function to select exam questions
|
43 |
-
def select_exam_(exam_name):
|
44 |
questions = parse_questions(f'questions/{exam_name}.set')
|
45 |
-
|
46 |
-
num_questions = 120
|
47 |
print("num_questions", num_questions)
|
48 |
selected_questions = questions[:int(num_questions)]
|
|
|
49 |
cleaned_questions = [
|
50 |
{'question': q['question'],
|
51 |
-
|
52 |
-
|
53 |
for q in selected_questions
|
54 |
]
|
55 |
return cleaned_questions
|
|
|
40 |
return questions
|
41 |
|
42 |
# Function to select exam questions
|
43 |
+
def select_exam_(exam_name, num_questions=2):
|
44 |
questions = parse_questions(f'questions/{exam_name}.set')
|
45 |
+
num_questions = len(questions)
|
|
|
46 |
print("num_questions", num_questions)
|
47 |
selected_questions = questions[:int(num_questions)]
|
48 |
+
#return selected_questions
|
49 |
cleaned_questions = [
|
50 |
{'question': q['question'],
|
51 |
+
'options': [o.replace('- [ ] ', '').replace('- [x] ', '').replace('- [X] ', '') for o in q['options']],
|
52 |
+
'correct': q['correct'].replace('- [x] ', '').replace('- [X] ', '') if q['correct'] is not None else ''}
|
53 |
for q in selected_questions
|
54 |
]
|
55 |
return cleaned_questions
|