473,721 Members | 2,081 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 3448
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
1274
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
1418
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
2110
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
6410
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
3431
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
4760
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
12980
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
3383
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
1501
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
8852
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
8736
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9373
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...
0
9081
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...
1
6676
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Duprť who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4497
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3206
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
2
2590
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2143
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.