Python makes me happy!

Well…i am posting this as a newbie of Python. Python coders …please don’t look at it because you know the beauty of this language! I repeat..i am just a newbie.

a week ago..i came to know a about a programming language or in better word scripting language called Python.

I am just fond of this language as i found it more simpler than C/C++ or even Java.  A coding example of swapping of two numbers as follows in python:

#! /usr/bin/python

#Filename swap.py

a,b=10,5

print “a is “,a,”and b is “,b

a,b=b,a

print “a is “,a,”and b is “,b

Save this file as swap.py (.py extension reports that it’s a python file) make it executable my giving it execute permission using the following command:

chmod +x swap.py

When you run this script after saving  it as swap.py , you will get the following output:

a is  10 and b is  5
a is  5 and b is  10

I hope you are remembering those codes in C/C++ and in python a single liner does the whole swapping work…interesting. Isn’t it?

Python is platform independent. You are free to run it on Windows/ Linux or Mac/Solaris systems. FYI, I use Ubuntu linux!

Is there any online study material for the same?: yes..there is! you can read Python documentation or download a book by Mr. Swaroop C H . Heartiest thanks from my side, Swaroop for your effort !


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s