Developers' Forum

Random numbers (list) for each student

Random numbers (list) for each student

by miki dream -
Number of replies: 2

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


In reply to miki dream

Re: Random numbers (list) for each student

by Richard Lobb -

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.

In reply to Richard Lobb

Re: Random numbers (list) for each student

by miki dream -
we will try that .
thank you very mutch