Wednesday, September 4, 2013

Python programming language

Python programming language is more powerful and is often comparable to Perl,Ruby or Java.
Readability of syntax is a distinguishing factor of Python.Python is available for all major operating systems: Windows, Linux/Unix, OS/2, Mac.Python is friendly and easy to learn.

          Comparing to Java,Python programs are 3-5 times smaller than java prog's.Python is dynamic typed language.Python programmers don't need to waste time in declaring variable types as in java.

          List is one of the Data Structure used in Python.Main feature is LIST COMPREHENSION.
Python supports a concept called "list comprehensions". It can be used to construct lists in a very natural, easy way, like a mathematician is used to do.


for eg:

            >>> a=[1,2,3,4]  
            # want to square each item in list a.  
            >>> b=[]  
            >>> for i in a:  
                 b.append(i*i)  
            >>> b  
                [1,4,9,16]  
using List Comprehension: 
            >>> b=[i*i for i in a]  
            >>> b  
                [1,4,9,16]  

No comments:

Post a Comment