Hi,
I’m trying to add a Math Expression Input, and this is my code. However, I encountered an error in the studio: ‘Invalid input: Could not parse ‘a^2 + 2ab + b^2’ as a formula.’
Could anyone help me find the problem?
Staff debug info: Traceback (most recent call last): File “/openedx/edx-platform/xmodule/capa/responsetypes.py”, line 3099, in tupleize_answers out.append(evaluator( File “/openedx/venv/lib/python3.8/site-packages/calc/calc.py”, line 249, in evaluator math_interpreter.parse_algebra() File “/openedx/venv/lib/python3.8/site-packages/calc/calc.py”, line 409, in parse_algebra self.tree = (expr + stringEnd).parseString(self.math_expr)[0] File “/openedx/venv/lib/python3.8/site-packages/pyparsing/core.py”, line 1141, in parse_string raise exc.with_traceback(None) pyparsing.exceptions.ParseException: Expected string_end, found ‘ab’ (at char 13), (line:1, col:14) During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/openedx/edx-platform/xmodule/capa_block.py”, line 1777, in submit_problem correct_map = self.lcp.grade_answers(answers) File “/openedx/edx-platform/xmodule/capa/capa_problem.py”, line 436, in grade_answers new_cmap = self.get_grade_from_current_answers(answers) File “/openedx/edx-platform/xmodule/capa/capa_problem.py”, line 494, in get_grade_from_current_answers results = responder.evaluate_answers(self.student_answers, oldcmap) File “/openedx/edx-platform/xmodule/capa/responsetypes.py”, line 314, in evaluate_answers new_cmap = self.get_score(student_answers) File “/openedx/edx-platform/xmodule/capa/responsetypes.py”, line 3081, in get_score correctness = self.check_formula( File “/openedx/edx-platform/xmodule/capa/responsetypes.py”, line 3183, in check_formula student_result = self.tupleize_answers(given, var_dict_list) File “/openedx/edx-platform/xmodule/capa/responsetypes.py”, line 3148, in tupleize_answers raise StudentInputError( # lint-amnesty, pylint: disable=raise-missing-from xmodule.capa.responsetypes.StudentInputError: Invalid input: Could not parse ‘a^2 + b^2 + 2ab’ as a formula