Having issues with a str not defined. I’ve identified it as being an issue with using .upper() but changing it to .toUpperCase() hasn’t helped.
Here is the Python code.
p1corr = 0
if recall_resp.rt:
if CorrectAnsR1 in str.upper(Recall_Typed.text):
p1corr = 1
else:
p1corr = 0
else:
p1corr=0
phase1corr.append(p1corr)
Here is the JS code:
var _pj;
function _pj_snippets(container) {
function in_es6(left, right) {
if (((right instanceof Array) || ((typeof right) === "string"))) {
return (right.indexOf(left) > (- 1));
} else {
if (((right instanceof Map) || (right instanceof Set) || (right instanceof WeakMap) || (right instanceof WeakSet))) {
return right.has(left);
} else {
return (left in right);
}
}
}
container["in_es6"] = in_es6;
return container;
}
_pj = {};
_pj_snippets(_pj);
p1corr = 0;
if (recall_resp.rt) {
if (_pj.in_es6(CorrectAnsR1, str.toUpperCase(Recall_Typed.text))) {
p1corr = 1;
} else {
p1corr = 0;
}
} else {
p1corr = 0;
}
phase1corr.push(p1corr);
It converts the written answers to upper text to check against correct answers in a typed response
Any help would be great