Tuesday, July 7, 2015

Discovering Python !!

Even before I start writing the usage of python on how wonderful it is as programming language and start praising it incessantly . Let me start by pointing to an article in ET which states as to why the need to learn python ? what are its trends ? Where does it stand on the list of technologies that are relevant today.
One line to describe that would be "right there on top and its awesome".

A nice read here

Now coming back to the topic of discussion , what is python ? For those of you who have heard of python , you might also have heard of Anaconda and Spyder ! These are neither snakes nor insects . Python is a programming language and that too Object Oriented programming language . who would have thought python as an object oriented language. I didn't believe it either when I started learning python once upon a time . Now what is Anaconda ? It is a set of python packages bundled together and Spyder being its IDE( integrated development environment )
For folks who are trying to learn python for the first time , you should start with one of the IDE's preferably Anaconda. You can also choose to use pycharm , Ipython , WindIDE, PyDev, Komodo IDE , Eric , IEP and the list is endless . I have never used some of then !

Ok , so python is an object oriented programming language so what ! There are many other programming language such as Java , C++, C#, VB.Net . What is so special about python ?

Let me present my case with a simple example , lets say I want to write a simple basic , our own hello world program .


There we go , a simple print "hello world" does the trick for us .






Now lets write a "hello world " program in Java.Looks at the left hand side and see for yourself doesn't it look like a lot of syntax and semantics? Indeed it does !


To arouse your interest further , Let me first take you through some basic questions that are frequently asked about python.

What kind of language is python , is it compiled or interpreted ?
Python is an interpreted language, as opposed to a compiled one, though the distinction can be blurry because of the presence of the bytecode compiler. This means that source files can be run directly without explicitly creating an executable to run.

Will i be able to create a website in python ?
Yes you will be able to create a website in python .

which language is better R or Python?
I would say , It depends on the usage but personally I prefer python more because of its clean syntax , automatic garbage collection , proper memory management as compared to R .

To know more about compiler and and interpreter . Follow this link 

Now so as to keep interest in python alive , let me demo a simple web-scraping program. Web-Scraping is a process of pulling data directly from websites.
Lets say, If I want to pull the movie details from website http://www.imdb.com/ .I need the list of all hit movies which has been released in the year 2012 to 2014 based on its rating . Here is what I have to do ( as given below )


This simple 12 line code will pull you data from imdb.com without any hassle . Isn't this wonderful?
Note : The copy paste of the code might not work because the link is incomplete in the screenshot .





Now that I have your attention . Keep watching the space for more updates . I plan to have a series of videos and tutorials to help all of you understand python and its nuances .

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. cool..looking forward to read more on python and watching Space (Key) too :)

    ReplyDelete