12 Apr 2004 kabads   » (Observer)

I've not had as much time as I'd like to look into python - however, I've written my obligatory calc script (with no error checking).

Feel free to try it for yourselves (note that advogator doesn't really look after indentation, or I haven't found out how to do it yet). Indentation is key in python.

First impressions are that python is nice and clean. I could do some special stuff with this, given my time commitments now. I'm thinking about writing a little app which keeps tracks of my computer magazine collection and the articles within (I waste loads of time flicking through all the magazines to find an article from Nov 2002). If something comes of this, I'll post it here.

#! /usr/bin/env python import sys

arg1 = raw_input("What is your first number?:") oper = raw_input("What operation: +, -, *, / ?") arg3 = raw_input("What is your second number?:")

num1 = float(arg1) num2 = float(arg3)

if oper == "+": answer = num1+num2 print answer elif oper == "-": answer = num1-num2 print answer elif oper == "/": answer = (num1/num2) print answer elif oper == "x": answer = (num1*num2) print answer

print num1, oper, num2, "=", answer

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!