Quiz

Ignore spaces

 
Picture of John Pap
Ignore spaces
 

Hello everybody,

I'd like to have a question type which ignores spaces.

For example, the answer is M = (N % 3) * 4

But the correct answers here are many, including M=(N%3)*4 

- Is there a way to do that ?

I searched many plugins and question types, but I was unable to find out a solution.

* I can use wildcards but a wildcard can match any character so if someone answers M=(2N%3)*4 will see correct, which is not smile

- Can I set a wildcard to space character only ?

Any tips ?

Thanks.

 
Average of ratings: -
Picture of Howard Miller
Re: Ignore spaces
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers

Moving to quiz forum...

Although, can this be done with, Regular_Expression_Short-Answer_question_type

 
Average of ratings: Useful (3)
Picture of John Pap
Re: Ignore spaces
 

Thanks,

I have this plugin and the truth is still can't find how.

I try with parentheses, ?, *.

Any hint could be very helpful.

 
Average of ratings: -
Picture of Marcus Green
Re: Ignore spaces
Core developersParticularly helpful MoodlersPlugin developersTesters

If you find a question type that will does a string match that ignores spaces and will accept

M=(N%3)*4

and also

M = ( N % 3) *4

It will also need to accept variations on 

M=4*(N%3)


 
Average of ratings: Useful (1)
Picture of Joseph Rézeau
Re: Ignore spaces
Core developersParticularly helpful MoodlersPlugin developersTestersTranslators

Hi John,

It might help if you said which QUESTION is asked to which you are expecting this answer.

A simple way to reduce acceptable answers would be to give clear instructions to the student, e.g. "do not use any blanks/spaces in your answer" OR "please separate ALL elements of your answer with blanks/spaces".

The REGEXP question type was primarily aimed at analysing answers written in "natural language", not maths or physics formulas, etc. However, it is possible to achieve what you want by entering those 2 formulas which will accept answers with or without blanks.

Formula #1: see below

will accept 128 possible answers, such as:

M = (N % 3 ) * 4
    M = (N % 3 ) *4
    M = (N % 3 )* 4
    M = (N % 3 )*4
    M = (N % 3) * 4
    M = (N % 3) *4
    M = (N % 3)* 4
    M = (N % 3)*4
    M = (N %3 ) * 4
    M = (N %3 ) *4
    M = (N %3 )* 4
    M = (N %3 )*4
    M = (N %3) * 4
    M = (N %3) *4
    M = (N %3)* 4
    M = (N %3)*4
    M = (N% 3 ) * 4
    M = (N% 3 ) *4
    M = (N% 3 )* 4
    M = (N% 3 )*4
    M = (N% 3) * 4
    M = (N% 3) *4
    M = (N% 3)* 4
    M = (N% 3)*4
    M = (N%3 ) * 4

etc.

Further to Marcus Green's suggestion, this formula will accept an inversion:

Formula #2: see below

will also accept 128 possible answers including:

M = 4 * (N % 3 )
M = 4 * (N % 3)
M = 4 * (N %3 )
M = 4 * (N %3)
M = 4 * (N% 3 )
M = 4 * (N% 3)
M = 4 * (N%3 )
M = 4 * (N%3)
M = 4 *(N % 3 )
M = 4 *(N % 3)
M = 4 *(N %3 )
M = 4 *(N %3)
M = 4 *(N% 3 )
M = 4 *(N% 3)

etc.

EDIT the text editor on this forum modifies my reg expressions so I have attached them as pics.

Hope that helps. Don't thank me, as POTUS would tweet "I am a genius", even if I say so myself.wink


 
Average of ratings: -