Skip to content

Question about answer_fn() and question_numeric() #797

Answered by gadenbuie
databeej2w asked this question in Q&A
Discussion options

You must be logged in to vote

The core problem you're encountering is that between rendering your tutorial's .Rmd file and running the Shiny app that the student sees, the question created with question_numeric() is written into static data. While the answer_fn() approach lets you define some code that is used to determine whether or not the student's answer is correct, technically in the interim the function body is written out as a character string.

In other words, when the question is shown to the user, it has to be completely isolated from the code that was used to create the question. This is why answer_fn() needs a function that only takes value as an argument.

The way to get around this is a little tricky. Basi…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@databeej2w
Comment options

Answer selected by databeej2w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants