Spaces:
Build error
Build error
update quiz modules
Browse files- scripts/quiz/generators.py +4 -3
- scripts/quiz/hints.py +2 -2
scripts/quiz/generators.py
CHANGED
@@ -14,11 +14,11 @@ def start_interactive_math(successful_answers=0, wrong_answers=0, level="easy"):
|
|
14 |
|
15 |
question_data = generate_question_answer_pair(level)
|
16 |
question = question_data['question']
|
17 |
-
|
18 |
current_number = question_data['current_number']
|
19 |
ordinal_number = question_data['ordinal_number']
|
20 |
|
21 |
-
numbers_group = [current_number, ordinal_number
|
22 |
if "times" in question_data:
|
23 |
times = question_data['times']
|
24 |
numbers_group.append(times)
|
@@ -26,9 +26,10 @@ def start_interactive_math(successful_answers=0, wrong_answers=0, level="easy"):
|
|
26 |
data_to_return = {
|
27 |
"text": question,
|
28 |
"question_numbers": numbers_group,
|
29 |
-
"right_answer":
|
30 |
'number_correct': successful_answers,
|
31 |
'number_incorrect': wrong_answers,
|
|
|
32 |
"hints_used": 0
|
33 |
}
|
34 |
return data_to_return
|
|
|
14 |
|
15 |
question_data = generate_question_answer_pair(level)
|
16 |
question = question_data['question']
|
17 |
+
right_answer = question_data['answer']
|
18 |
current_number = question_data['current_number']
|
19 |
ordinal_number = question_data['ordinal_number']
|
20 |
|
21 |
+
numbers_group = [current_number, ordinal_number]
|
22 |
if "times" in question_data:
|
23 |
times = question_data['times']
|
24 |
numbers_group.append(times)
|
|
|
26 |
data_to_return = {
|
27 |
"text": question,
|
28 |
"question_numbers": numbers_group,
|
29 |
+
"right_answer": right_answer,
|
30 |
'number_correct': successful_answers,
|
31 |
'number_incorrect': wrong_answers,
|
32 |
+
'level': level,
|
33 |
"hints_used": 0
|
34 |
}
|
35 |
return data_to_return
|
scripts/quiz/hints.py
CHANGED
@@ -3,9 +3,8 @@ from random import random
|
|
3 |
|
4 |
import random
|
5 |
|
6 |
-
def generate_hint(question_numbers, number_correct, number_incorrect, hints_used):
|
7 |
ordinal_number = question_numbers[1]
|
8 |
-
right_answer = question_numbers[2]
|
9 |
equation = right_answer - 2 * ordinal_number - 1
|
10 |
least_number = equation if equation > 0 else 0
|
11 |
seq_before_answer = " ".join(
|
@@ -29,6 +28,7 @@ def generate_hint(question_numbers, number_correct, number_incorrect, hints_used
|
|
29 |
"right_answer": right_answer,
|
30 |
'number_correct': number_correct,
|
31 |
'number_incorrect': number_incorrect,
|
|
|
32 |
"hints_used": hints_used
|
33 |
}
|
34 |
return data_to_return
|
|
|
3 |
|
4 |
import random
|
5 |
|
6 |
+
def generate_hint(question_numbers, right_answer, number_correct, number_incorrect, level, hints_used):
|
7 |
ordinal_number = question_numbers[1]
|
|
|
8 |
equation = right_answer - 2 * ordinal_number - 1
|
9 |
least_number = equation if equation > 0 else 0
|
10 |
seq_before_answer = " ".join(
|
|
|
28 |
"right_answer": right_answer,
|
29 |
'number_correct': number_correct,
|
30 |
'number_incorrect': number_incorrect,
|
31 |
+
'level': level,
|
32 |
"hints_used": hints_used
|
33 |
}
|
34 |
return data_to_return
|