Coderunner is a nice piece of work. I'm planning to try it on a first-year engineering programming course, for over 200 students.
How does one create a python3 question that takes input from a file? I could not figure this out. Any help would be much appreciated.
Indian Institute of Technology Mandi
It depends what sort of task you're setting the students. As a first example, suppose you're asking students to write a function student_func that takes a file object as a parameter and prints some data derived from that file. Then you can just upload the test files you want via the Support files section of the author editing form. They will then appear in the runtime directory, ready to be used in any tests. For example, if you set two support files test1.txt and test2.txt then for your two test cases you could have something like:
infile = open('test1.txt')
infile = open('test2.txt')
If instead you want the students to write a program that reads from standard input, you simply put the data (think of it as a file if you like) in the test case Standard input field.
If you want students to write a program that takes a filename as a command line argument you have to jump through a few more hoops. See the forum discussion here.
As mentioned before, I am hoping to try CodeRunner on a large class. The topic is on data science, and the code the students write will involve calling of python library functions (numpy, pandas etc.) So I will try reading large csv files.
With many thanks for your support,
Hope it works for you, Padmanabhan. You will of course have to install numpy, pandas, etc on your Jobe server, as they're not part of the standard build. You'll also need to use a customised question or question type with a higher memory limit (say 1 GB or more) and perhaps a higher process limit (sandbox parameter numprocs). And the file size you can process will be limited by your Moodle server's PHP settings for the maximum POST size and maximum file upload size. These can be raised if necessary.
Thank you for the pointers. I tried it on small files, and everything seems to be working well. I installed the required packages on the Jobe server.
Since one of our administrators have been helping me out, I will pass on your tips about the sandbox settings to him. Is there a config file for this?
I have a query. In your help video, you had said that it is necessary to make the quiz "adaptive". Is this necessary? I assume this means that the quiz provides questions based on how many are answered correctly. In the typical exams I hope to conduct, I do not need this behaviour. Any suggestions on this would be helpful.
On the whole, Coderunner seems to meet most (if not all) of our needs. Our semester begins in a week. Then we will try it out on the large class. I really appreciate your efforts in developing Coderunner. I have suggested it to a few other Indian universities as well.
With many thanks
Pleased to hear you're finding CodeRunner useful.
Resource limits like timeout and number of processes are all set by customising the question. There's a screen shot showing the settings in this forum discussion: https://coderunner.org.nz/mod/forum/discuss.php?d=141. If you're going to have many such questions, though, you should define a new question type with the required settings in it; see the documentation on user-defined question types.
No, it's not really necessary any more to make the quiz behaviour adaptive, because CodeRunner now forces that mode regardless of the quiz mode. It didn't used to do that. Additionally you can set each question to hide or display the result table regardless
of the mode. But I strongly recommend that if you want authentic assessment you display the result table to the students so they can correct trivial errors (or not correct them if they don't know how). Having made the decision to display the result
table (which is the default situation) you can then decide which test cases to show or hide, giving you fine structured control over the feedback. But I think it's more or less essential to at least let students know if their code is correct. Otherwise
trivial errors like missing one character in a copy-and-paste operation will result in loss of all marks.