Wednesday, March 02, 2011

My first Python script

I've started reading a Python tutorial and this is the first little script I wrote :

#!/usr/bin/env python

print a[0] + str(len(a[1:-1])) + a[-1]

print a[0] + str(len(a[1:-1])) + a[-1]

If it is executed, you get :


It's not much, but slightly less boring than the usual "Hello World!".
Basically, it just takes the first and last character of each word, and replaces the characters in between with the total number of characters in between. The exciting thing about it, is the sheer compactness of the syntax. In any other language a lot more code would be needed. :)

BTW : i18n and l10n are widely used numeronyms, that refer to internationalization and localization.