473,598 Members | 3,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

automatically grading small programming assignments

Hello,

I have a couple of classes where I teach introductory programming using Python. What
I would love to have is for the students to go through a lot of very small programs,
to learn the basic programming structure. Things like, return the maximum in a list,
making lists with certain patterns, very simple string parsing, etc. Unfortunately,
it takes a lot of time to grade such things by hand, so I would like to automate it
as much as possible.

I envision a number of possible solutions. In one solution, I provide a function
template with a docstring, and they have to fill it in to past a doctest. Is there a
good (and safe) way to do that online? Something like having a student post code,
and the doctest returns. I'd love to allow them to submit until they get it, logging
each attempt.

Or perhaps there is a better way to do this sort of thing. How do others who teach
Python handle this?
thanks,
Brian Blais

--
-----------------

bb****@bryant.e du
http://web.bryant.edu/~bblais
Dec 14 '06 #1
17 3434
Brian Blais wrote:
Hello,

I have a couple of classes where I teach introductory programming using Python. What
I would love to have is for the students to go through a lot of very small programs,
to learn the basic programming structure. Things like, return the maximum in a list,
making lists with certain patterns, very simple string parsing, etc. Unfortunately,
it takes a lot of time to grade such things by hand, so I would like to automate it
as much as possible.

I envision a number of possible solutions. In one solution, I provide a function
template with a docstring, and they have to fill it in to past a doctest. Is there a
good (and safe) way to do that online? Something like having a student post code,
and the doctest returns. I'd love to allow them to submit until they get it, logging
each attempt.
On a different matter, coding style, you could run something such as
Pylint on submitted codes and penalize them based on the number of
warnings emitted.
Maybe some adjustments would be necessary -- my experience with picky
compilers is that most but not ALL warnings indicate problems.

Dec 14 '06 #2

Brian Blais wrote:
Hello,

I have a couple of classes where I teach introductory programming using Python. What
I would love to have is for the students to go through a lot of very small programs,
to learn the basic programming structure. Things like, return the maximum in a list,
making lists with certain patterns, very simple string parsing, etc. Unfortunately,
it takes a lot of time to grade such things by hand, so I would like to automate it
as much as possible.

I envision a number of possible solutions. In one solution, I provide a function
template with a docstring, and they have to fill it in to past a doctest. Is there a
good (and safe) way to do that online? Something like having a student post code,
and the doctest returns. I'd love to allow them to submit until they get it, logging
each attempt.

Or perhaps there is a better way to do this sort of thing. How do others who teach
Python handle this?
It might turn out to be a poor substitute for the personal touch,
especially If they are just starting to program.

- Paddy.

Dec 14 '06 #3
Brian Blais wrote:
I have a couple of classes where I teach introductory programming using
Python. What I would love to have is for the students to go through a
lot of very small programs, to learn the basic programming structure.
Things like, return the maximum in a list, making lists with certain
patterns, very simple string parsing, etc. Unfortunately, it takes a
lot of time to grade such things by hand, so I would like to automate it
as much as possible.

I envision a number of possible solutions. In one solution, I provide a
function template with a docstring, and they have to fill it in to past
a doctest. Is there a good (and safe) way to do that online? Something
like having a student post code, and the doctest returns. I'd love to
allow them to submit until they get it, logging each attempt.
A few people were playing around with a secure Python online
interpreter/interactive prompt a while back:

http://groups-beta.google.com/group/...46d738a8859c2f

I don't think any of them was quite at the usability level you'd need
though.
Can you just have the students download one file for each program you
want them to run? I'd ship something like::

import unittest

# =============== =============== ==========
# This is the function you need to fill in
# =============== =============== ==========
def list_max(items) :
'''Your code goes here'''
# =============== =============== ====
# Don't modify code below this point
# =============== =============== ====
class Test(unittest.T estCase):
def test_range(self ):
self.failUnless Equal(list_max( range(10)), 10)
def test_first_elem (self):
self.failUnless Equal(list_max([1, 0, 0, 0]), 1)
...

if __name__ == '__main__':
unittest.main()

Then all your students would have to do is download the file, fill in
the definition of the appropriate function, and run the same file until
the unittest said that everything worked. I guess that doesn't solve
your "logging each attempt" problem though...

STeVe
Dec 14 '06 #4
Brian Blais, just an idea. Create an online form to upload the tiny
program(s). Such programs can be one for file. Then on your PC you can
run a script that loads each of such programs, and runs a good series
of tests, to test their quality... Such tests can be about all things,
speed, coding quality, that the results are correct, etc. You can even
put some way to autenticate students... (BTW, good students don't
cheat. Cheating isn't a good way to learn to program, and they probably
know this).

Bye,
bearophile

Dec 14 '06 #5

be************@ lycos.com wrote:
Then on your PC you can
run a script that loads each of such programs, and runs a good series
of tests, to test their quality...
What happens if someone-- perhaps not even someone in the class-- does
some version of os.system('rm -Rf /') ?

Dec 14 '06 #6
Am Thu, 14 Dec 2006 12:27:07 -0500
schrieb Brian Blais <bb****@bryant. edu>:
Hello,

I have a couple of classes where I teach introductory programming
using Python. What I would love to have is for the students to go
through a lot of very small programs, to learn the basic programming
structure. Things like, return the maximum in a list, making lists
with certain patterns, very simple string parsing, etc.
Unfortunately, it takes a lot of time to grade such things by hand,
so I would like to automate it as much as possible.

I envision a number of possible solutions. In one solution, I
provide a function template with a docstring, and they have to fill
it in to past a doctest. Is there a good (and safe) way to do that
online? Something like having a student post code, and the doctest
returns. I'd love to allow them to submit until they get it, logging
each attempt.

Or perhaps there is a better way to do this sort of thing. How do
others who teach Python handle this?
thanks,
Brian Blais

Perhaps the Sphere Online Judge can help you: https://www.spoj.pl/info/
Dennis
Dec 14 '06 #7

be************@ lycos.com wrote:
Then on your PC you can
run a script that loads each of such programs, and runs a good series
of tests, to test their quality...
What happens if someone-- perhaps not even someone in the class-- does
some version of os.system('rm -Rf /') ?

Dec 14 '06 #8
co************* @hotmail.com wrote:
be************@ lycos.com wrote:
Then on your PC you can
>run a script that loads each of such programs, and runs a good series
of tests, to test their quality...
What happens if someone-- perhaps not even someone in the class-- does
some version of os.system('rm -Rf /') ?

The system administrator should make sure that student user accounts (or
the auto testing account) doesn't have access to that. Probably should
make sure that user applications only get a limited amount of memory too.

--

Carl J. Van Arsdall
cv*********@mvi sta.com
Build and Release
MontaVista Software

Dec 14 '06 #9
co************* @hotmail.com wrote:
be************@ lycos.com wrote:
Then on your PC you can
>run a script that loads each of such programs, and runs a good series
of tests, to test their quality...
What happens if someone-- perhaps not even someone in the class-- does
some version of os.system('rm -Rf /') ?
I was thinking of including a dummy os.py and sys.py, so import os, and import sys
would fail. Would this work? Is there anything else obvious. I can have student
authentication, that's not a problem.
bb
--
-----------------

bb****@bryant.e du
http://web.bryant.edu/~bblais

Dec 15 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1264
by: Rikard Land | last post by:
I try to model a data definition language in XML. It can be seen as C without any executable statements other than variable assignments. I want to allow for: (1) type declarations ("structs" in C), which can be nested, and where each member can be (optionally) associated with a) a comment (as a help to the user who will enter data) and b) a unit such as kg, cm, etc. (2)variable declarations of ordinary types such as float, int, string,...
0
1408
by: C.E.O. Gargantua | last post by:
http://blog.seattlepi.nwsource.com/microsoft/ Featured in the blog: Grading Bill Gates Charles Cooper, CNet News.com executive editor, assesses the performance of Bill Gates as the company's chief software architect in the five years since he turned over the chief executive's role to Steve Ballmer.
3
2108
by: bearophileHUGS | last post by:
The current version of ShedSkin (http://shedskin.sourceforge.net/ experimental Python to C++ compiler) is rather alpha, and the development work is focused on debugging and implementing some more basic Python functionality. But hopefully in future versions more work will be spent to make the resulting C++ programs as fast as possible. One of the many possible details that may be improved, is the compiling to C++ of the Python "parallel"...
1
6396
by: Louis | last post by:
Hi, I am a first time poster here. I have been given an assignment to do from college and it is ot create a student gradebook. I have planned all the tables etc. to what I believe to be correct. I have also set the relationships etc. I have three tables here that are causing the most problems. These are: Students - contains information on students Assignments - this is the actual work the students should be doing Results - These are...
6
3420
by: Jim C. Nasby | last post by:
Is there any reason why there isn't a predefined cast to go from a timestamp to a varchar? Is there a reason not to add one? -- Jim C. Nasby, Database Consultant jim@nasby.net Member: Triangle Fraternity, Sports Car Club of America Give your computer some brain candy! www.distributed.net Team #1828 Windows: "Where do you want to go today?" Linux: "Where do you want to go tomorrow?" FreeBSD: "Are you guys coming, or...
3
4735
by: Akinyemi | last post by:
I am writing a Visual Basic program for calculating students scores, and also grading the highest 3 scores as "First" , "Second" and "Third" respectively. I have been able to get the program to compute the score of each student. I have not been able to grade the highest three scores into First, second and third. Kindly assist me, please.
4
12970
by: hjc | last post by:
i am trying to created a program that will write a grading program for a class with the following policies there are 2 quizzes each graded on the basis of 10 points there is 1 midterm and 1 final each graded on 100 points the final exam counts for 50% of the grade, the midterm counts for 25% and the 2 quizzes togehter count for a total of 25%(i have to normailze the scores) letter grades based on 90-100 A 80-89 B 70-79 C
9
3377
by: Grimmjow04 | last post by:
first of all, im a beginner with this thing.. turbo C,, my prof gave us a homework: we must do a grading system consist of: format>>> Grading System Enter your name:
1
1492
7 of 9
by: 7 of 9 | last post by:
Hello all, Here is my question. I have a query that calculates the average weight of an item. I would like to assign that weight to a predefined grade. Let’s say I have the following grading scale: Grade Range A 0-999 B 1000-99999 C 100000-999999
0
7991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8395
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8050
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8265
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6719
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5438
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3939
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2412
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1504
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.