setting question in python 3

setting question in python 3

por Murugan m -
Número de respuestas: 2
Murugan.M
India.
 Hello,
I am much interested teaching python through moodle. I have installed coderunner successfully in my moodle 3.7 website.
 I have set the question write python 3 function to find sqr(), it is working fine.
 But, still I am not clear about setting question. For example,
 Write a python 3 program to add 2 numbers.
The correct program is
 x = int(input("Enter value of x "))
y = int(input("Enter value of y "))
 z = x + y print (z)
 What I should give in
 answer box preload,
Test case 1 :
 Expected input :
 Expected output :
 Can anybody answer my question?
My thanks in advance.

 Murugan.M
En respuesta a Murugan m

Re: setting question in python 3

por Richard Lobb -

For that question you would probably want to use the python3_w_input question type.

Then you would have test cases like:


Test case 1 (empty)
Standard input 2
5
Expected output  Enter value of x 2
Enter value of y 5
7
Extra template data  (empty)
Test case 2 (empty)
Standard input 23
-11
Expected output  Enter value of x 23
Enter value of y -11
12
Extra template data  (empty)

I recommend you read the Architecture of CodeRunner section in the documentation, plus the following sections which explain how question types work and how to customise them to your own needs.