STACK Algebraic to String

STACK Algebraic to String

by Joel Scott -
Number of replies: 2
I have a question which asks for the *name* of the person who earns the least but I want to also accept the *amount* that the person earns.

When I set the input as algebraic, it objects to entering a string without quotes (which I want to avoid using because the students I'm working with are low literacy and potentially ESL).

"This answer is invalid. Forbidden variable or constant:"

I would have thought I could include a string in an algebraic and use the string(ex) function to convert the name to a string but I don't think I'm getting that far.
Check Type, Validation and Student Verify are all set to No.

If I set the input to String, it objects to a numerical input.

I have added the list of names to the allowed list for the input but that doesn't seem to have solved the problem.

I've attached the question as well.
Average of ratings: -
In reply to Joel Scott

Re: STACK Algebraic to String

by Jonathan Shapiro -
I probably do not understand the question, but don't you need two answer boxes, one for the name and one for the amount. With a one-word name, your students can enter without quotes. E.g they enter Smith, then use StringSloppy as answer test, String(ans1) as student answer and "Smith" as teacher answer. Better use sdowncase(ans1) as student answer. This converts Smith into "smith" so you do not have to worry about the case. But if the name is two words, e.g. John Smith, I do not know if you can do this with one answer box. 

For the amount they earn, use a second answer box with an appropriate answer test depending on whether the amounts are integers or floats. 
In reply to Jonathan Shapiro

Re: STACK Algebraic to String

by Joel Scott -
Yeah I could re-design the question that way, iwth two separate inputs for the two parts of the answer.
My intention was to make it as simple as possible (with the literacy challenges) and allow for some variation in the interpretation of what was required.
I'm using the Levenshtein answer test and I have that working if the input is set to a string but I don't understnad why I cant set it to an algebraic input and then use that string(ex) function. Incidentally, ithat process (converting an algebraic input to a string) works perfectly when I input the letter of the name (allowing for the case where the student interprets it as a multiple choice problem and enters a, b or c).

I think that it's coming down to my not using the 'allowed words' list correctly but I don't know what I'm doing wrong with that.
I have tried creating a variable listNames: [name1,nema2,name3] and putting it in the input for allowed workds as well as directly listing the variables with just commas between them. Unless allowed workds can't interpret variables?