How to accept all types answer

How to accept all types answer

by Saqib Ali -
Number of replies: 1

hi I am really impressed by your work ,I am facing small problem can you help me out please?

I need to get answer in any case like small letters ,upper letters , mixture of upper and lower cases , with extra spaces or less spaces.let me explain morel need to accept following all answers for Hello World code in python3.

print ("Hello World")

Print ("Hello World")

PRINT("Hello World")

print  ("Hello World")

print ('Hello World')

I need to accept all possible answers.Thanks for your help.

In reply to Saqib Ali

Re: How to accept all types answer

by Richard Lobb -

The first and the last two of those answers are valid Python code, and they should all print Hello World and thus all be accepted. The second and third answers are not valid Python code and will give syntax errors when run.

As the name indicates, CodeRunner is intended to run code as part of the marking process and it can't run invalid code.

You could modify the prototype to convert all Python keywords and built-in library functions to lower-case but this seems like the wrong solution. Why not teach your students to write valid Python code?