Buzz: Questions & Answers

Help with eval function and feedback

Follow
Answered
Bruce Sharp

Is there anywhere I can find help on using the eval function in writing questions and how to code feedback?

I have been using eval for a while with variables. I've learned a few ins and outs like I have to put eval() in the answer for math - exact, but not for math - equivalent. Right now I'm trying to write a question where the students have to type in units. I used the code below with the question type set to normal and it marks everything wrong. I've tried adding the $ and ,# to the answer, but that doesn't help. When I change the question type to math - exact it works as expected.

Type: F
Options: ShowCorrect
Var: LM = 8..39,0.5
2) Point `M` bisects `bar{LN}`. Find `LN` if `LM = $LM$` ft.
`LN =` ________

a. eval(2*$LM$)ft

 

Then I tried to add feedback so if the student types in the correct number, but forgets the units they are prompted to include units. I cannot get the feedback to appear for me though. The code is below. I've tried changing the answer inside the [ ] to say eval and to have an = in front, but nothing seems to work.

Type: F, Match
Options: ShowCorrect
Var: LM = 8..39,0.5
2) Point `M` bisects `bar{LN}`. Find `LN` if `LM = $LM$` ft.
`LN =` ________
@[2*$LM$] Don't forget your units. :)

a. eval(2*$LM$)ft

Comments (6)

Sort by
Bruce Sharp

No ideas or help files? :/

0 Comment actions Permalink
Brad Marshall
  • Agilix team member

Hey Bruce, the feedback worked for me when I tried the following.

 @[=eval(2*$LM$)] Don't forget your units. :)

Does this work for you?

As our documentation shows (see Advanced Assessment Editor), you should also be able to do

@[=2*$LM$] Don't forget your units. :)

, but I am still investigating if it does.

0 Comment actions Permalink
Bruce Sharp

Thanks Brad. I see my code doesn't have the = in the brackets, which is odd since I originally used the visual editor which should have put them in. Maybe in my messing around I accidentally deleted them. I'll test it in the morning and let you know.

0 Comment actions Permalink
Bruce Sharp

Reading through the help file you linked I see that eval only works for number, match, and equivalent question types. That's why it was marking it wrong when the question type was normal. I was looking for the link to that help file in Buzz and couldn't find it. Can you please remind me where it is?

Bruce

0 Comment actions Permalink
Bruce Sharp

I tested your feedback and the first one worked perfectly. The second one did not so it required the eval() to be there. This may be related to the question type though. "Match" requires that I put eval(2*$LM$) in the answer. "Equivalent" just wants 2*$LM$ as the answer. Maybe that also applies to feedback?

Thanks for your help!

0 Comment actions Permalink
Brad Marshall
  • Agilix team member

Hey Bruce, talking with someone on our team, he said that you are right. If the question is type “Equivalent”, then you can use:

@[=2*$LM$] Don't forget your units. :)

But if the question is type “Match,” then you need the `eval`.

0 Comment actions Permalink
Please sign in to leave a comment.