Monday, 23 June 2008

Short break

No posts in the next couple of days due to school & work deadlines approaching at speed.

Monday, 16 June 2008

Comic relief #2

King Arthur would make a great programmer. Look at his problem solving skills.

More on strings and data in general

IDLE 1.2.1 #That's my Windows Python GUI
>>> x = 'hello'
>>> y = 'll'
>>> x in y
False
>>> y in x
True

Wednesday, 11 June 2008

Methods

A simple example that explains it all:

>>> 'bob' .upper()
'BOB'

Comic relief #1

Looking at all the spamify() functions in my Python manuals reminded me of the great heritage Python advertises and at the same time gave me an idea about making this blog a tad more colorful. The first of the comic reliefs. A true classic.

Monty Python attacks for the first time - strings




#!/usr/bin/python

print 'Spam' + 'Eggs'
print "Ni!" * 10

Both single and double quotes accepted.

Thursday, 8 May 2008

Simple math

#! /usr/bin/python
# kg 2 stone converter

print "Mass in kilos?"
mass_kg = int(raw_input())
mass_stone = mass_kg * 2.2 / 14
print "Mass in stones is" + str(mass_stone) + " stone."