Calc.py treating variables as functions

16 views
Skip to first unread message

Kyle Boots

unread,
Sep 28, 2017, 10:46:42 AM9/28/17
to General Open edX discussion

There is a bit of a nuanced issue with the calc.py handles variables when a multiplication sign isn't used. The issue is that you can have a math expression problem that allows a variable, but then the problem feedback says that the variable isn't allowed. This happens when a variable is put up next to a parenthesis. For example a problem could allow x and y. Say the correct answer of the problem is x*(3+y) but the user could put x(3+y). The issue is that the user is given the feedback, "Invalid input: x not permitted in answer."


This is happening because calc.py is treating the x as a function x(). So it gives an erroneous error output. This can be confusing to learners because x is permitted and they may try and resubmit their answer without the needed variable.


Our thought is that this could be resolved by separating out the error reporting to include errors for variables and errors for functions. In that way feedback could be given that is more appropriate. So perhaps the function error could just say, "There seems to be a formatting issue with your input. Please review it and try again"
https://github.com/edx/edx-platform/blob/master/common/lib/calc/calc/calc.py#L432

Reply all
Reply to author
Forward
0 new messages