I am learning Python. Coding is Fun in python. Thing are bit easy around here. lets start with a hello world program, click here.
Simple Input and output
a = raw_input("input a nonint here: ")
print "a = ", a
Swap
lets me write one very funny code stuff to swap to value in python.
lets do it in C (or any other language)
int a, b, other; a = 5; b = 6; other = a; a = b; b = other;
Of the record in my first semester I have learned something from Nishad (One of my dearest friend, swapping without taking a new variable)
a = a + b; b = a - b; a = a - b;
Let do it in python way,
a,b = 5,6 a,b = b,a #that's it.. WOW.. WOW WOW...
Syntax
lets make a cube function on C
int cube(int a){
return a * a * a;
}
main(){
cout <<>
}
in python,
{code type=codetype}
def cube(int a):
# there is no bracket’{}’ and no semicolon ‘;’
return a ** 3
# the indenting makes everything clear
{/codetype}
the rich text editor is cube (5) # it bet freaky ..
this Text editor is not printing thing as I want it to be printed.

10/08/2008 at 5:53 pm Permalink
ha ha ha…
thanks to the original inventor – s/he still amuses you. mathematics is indeed beautiful.