Check correctness of student's answer

Students are creating tables of values (different values for each student). Then they are asked to find the percents of different situations. Each student’s answer could be different from the others.

I would like the program to be self-checking. I just don’t know how to do that.

Example (from page 2) of what I am trying to do:
#m is the number of males. s is the number of those surveyed. p equals percent
m = table1.cellNumericValue(1,5)
s = table1.cellNumericValue(3,5)

p = simpleFunction(“m/s*100”)
correct: p=this.numericValue

simpleFunction needs to know what its variables are, and also needs specific inputs - it can’t just “carry” them from other defined variables I don’t think.

Instead, p=simpleFunction("m/s*100","m","s").evaluateAt(m,s) should do the trick :smile:

1 Like