Sunday, October 16, 2011

Python pre-101 or is it Go Wallabies

So python being the most basic language I know I am just gonna let it tell like it is.

A simple print 3-liner that only tells the program to print a Wallaby that sits on the All blacks. Due to laziness, I will just post my screen image so you can see the source file and the command-line from where the script is executed. Also for the sake of seeing the colour scheme in the editor and distinguish my gibbering from the code. Python doesn't get any easier than that so indulge yourself in this simple Python pre101 as you sit back and wait for a brutal crashing of the All Blacks tomorrow. The three magic steps being a) declare what s is, b) print it and c) exit program with success and boom that's it. Comments are purged out with a # as is clear. Go to the command prompt of your choice and do a python filename and that's it. I assumed that you already have python installed but my machine came with as do all linux distributions I suppose.

Specially for you JK.

And for all those interested in a real python 101 check out Swaroop's 'A Byte of Python'.
 

Here are the lines if not clear from the picture;
# Created by Wakariera on October 16th 2011.
#!usr/bin/python
# waka/desktop/wallabies.py


s = 'Wallabies > Allblacks and that is the only way out'
print s

exit #there is not even a chance of thinking about the < case because it simply isn't happening

*Compiled on GNU Debian Squeeze at 201110161204 with python 3.

No comments:

Post a Comment