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."

Thursday, 6 March 2008

Conditions (if) and indenting

>>> world_flat=1
>>> if world_flat:
... print "You can fall off!" #this line is indented
...
You can fall off!

Config stuff for Unix and Windows machines

Usual location of the interpreter:
/usr/local/bin/python (Unix)
C:\Python25 or sth similar (Windows)

Environment path setting (Windows)
set path path=%path%;C:\python25


Saturday, 1 March 2008

Drill #1

# <-comment
>>> a = 4 #assignment
>>> if a%2==0: #condition
print "whatever"

Friday, 29 February 2008

First notes

Python characteristics:

-interpreted
-creates bytecode normally saved to disk (one compilation)
-allows OO
-spaces matter
-indentation for indicating where block starts and ends ('{}' in C)
-dynamically typed (data type based on the stored value)

Python Programming

I´m beginning to think it would be a good subject for the otherwise unproductive process. Having actual content is the only way to go with blogs AND I have access to a Web-connected Linux machine these days.

It's bloggering time.

Thursday, 28 February 2008

Test post

Editor works.

Teacher´s mail jic

mrebollo at dsic.upv.es

notes:
send blog address & subject
author

First post

I don´t even know.