Visa version
Visa
< föregående
Jämför
< föregående
Lab 2
In these assignments you are expected to use Python and no additional libraries (except for standard libraries). The goal is to practice writing "pure" Python for those occasions when libraries or other good tools are not available for one reason or another.
Your code must be a Good Unix Citizen: your Python file itself is executable, files and arguments are read from the commandline (see below), and you use stdin, stdout, and stderr appropriately.
Basic assignments
These basic assignments are necessary to pass Lab 2.
There are also an advanced assignment available, for the possibility to raise your grade.
Reading from the commandline
As an example of how to read from the commandline, consider creating a file called "reveal" with this contents
#! /usr/bin/env python import sys print sys.argv
and then execute the command
chmod +x reveal
to make it executable. Then, try you new program by running (for example)
reveal a b c
How do you use this in this assignment?