Developers' Forum

Random numbers (list) for each student

Picture of miki dream
Random numbers (list) for each student
by miki dream - Thursday, 29 November 2018, 7:30 PM

Hello ,

I'm looking for a way to give out students an exercise that contain lists with randomly elements for each student (in python 3),

I would like to know how can we create test cases to check their submissions automatically?

I'm still new in Coderunner so I'm not familiar with all the settings and how to implemet Coderunner in Moodle.

For example :
each student get a list with random numbers 
student1: list[30,44,17]
student2: list[22,32,55]

so we want then to implement sum of the numbers and print them out:

Thank you very much

Picture of Richard Lobb
Re: Random numbers (list) for each student
by Richard Lobb - Saturday, 1 December 2018, 1:29 PM

CodeRunner randomisation is explained here. I'm not sure that your example warrants randomisation, however. If you're asking students to write a function or a program that adds a sequence of numbers, I'd suggest you just set up a number of tests with any suitable arbitrary data and make sure that at least one of the tests is hidden.

Randomisation is usually used to make it harder for students to copy code. If they're writing code that sums the given data, it'll work correctly regardless of the input data you give them - giving different students different data won't stop the copied code from working.

Picture of miki dream
Re: Random numbers (list) for each student
by miki dream - Wednesday, 19 December 2018, 8:52 PM
we will try that .
thank you very mutch