a) Simple and easy-to-learn: Python is a Simple language with few keywords, simple structure and it's syntax is also clearly defined. This makes Python a beginner's language.
b) Interpreted and Interactive: Python is processed at runtime by the interpreter. We need not compile the Program before executing it. The Python prompt Interact with the interpreter to interpret the Programs that you have written. Python has an option namely interactive mode which allows interactive testing and debugging of code.
c) Object-Oriented: Python supports Object Oriented Programming (OOP) concepts that encapsulate code within objects. All concepts in OOPs like data hiding, operator overloading, inheritance etc. can be well written in Python. It supports functional as well as structured Programming.
d) Portable: Python can run on a wide variety of hardware and software platforms and has the same interface on all platforms. All variants of Windows, Unix, Linux and Macintosh are to name a few.
e) Scalable: Python provides a better structure and support for large Programs than shell scripting. It can be used as a scripting language or can be compiled to bytecode (intermediate code that is platform independent) for building large applications.
f) Extendable: You can add low-level modules to the Python interpreter. These modules enable Programmers to add to or customize their tools to be more efficient. It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
g) Dynamic: Python provides very high-level dynamic data types and supports dynamic type checking. It also supports automatic garbage collection.
h) GUI Programming and Databases: Python supports GUI applications that can be created and ported to many libraries and windows systems, such as Windows Microsoft Foundation Classes (MFC), Macintosh, and the X Window system of Unix. Python also provides interfaces to all major commercial databases.
i) Broad Standard Library: Python’s library is portable and cross platform compatible on UNIX, Linux, Windows and Macintosh. This helps in the support and development of a wide range of applications from simple text processing to browsers and complex games.
Invoking the interpreter without passing a script file as a parameter brings up the following prompt
b) Interpreted and Interactive: Python is processed at runtime by the interpreter. We need not compile the Program before executing it. The Python prompt Interact with the interpreter to interpret the Programs that you have written. Python has an option namely interactive mode which allows interactive testing and debugging of code.
c) Object-Oriented: Python supports Object Oriented Programming (OOP) concepts that encapsulate code within objects. All concepts in OOPs like data hiding, operator overloading, inheritance etc. can be well written in Python. It supports functional as well as structured Programming.
d) Portable: Python can run on a wide variety of hardware and software platforms and has the same interface on all platforms. All variants of Windows, Unix, Linux and Macintosh are to name a few.
e) Scalable: Python provides a better structure and support for large Programs than shell scripting. It can be used as a scripting language or can be compiled to bytecode (intermediate code that is platform independent) for building large applications.
f) Extendable: You can add low-level modules to the Python interpreter. These modules enable Programmers to add to or customize their tools to be more efficient. It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.
g) Dynamic: Python provides very high-level dynamic data types and supports dynamic type checking. It also supports automatic garbage collection.
h) GUI Programming and Databases: Python supports GUI applications that can be created and ported to many libraries and windows systems, such as Windows Microsoft Foundation Classes (MFC), Macintosh, and the X Window system of Unix. Python also provides interfaces to all major commercial databases.
i) Broad Standard Library: Python’s library is portable and cross platform compatible on UNIX, Linux, Windows and Macintosh. This helps in the support and development of a wide range of applications from simple text processing to browsers and complex games.
How to Run Python
There are three different ways to start Python.a) Using interactive Interpreter
You can start Python from Unix, DOS, or any other system that provides you a command-line interpreter or shell window. Get into the command line of Python. For Unix/Linux, you can get into interactive mode by typing $python or python%. For Windows/Dos it is C : >python.Invoking the interpreter without passing a script file as a parameter brings up the following prompt
$ python
Python 2.7.10 (default, $ep 27 2015, 18:11:38) [GCC 5.1.1 20150422 (Red Hat 5.1.1-1)] on linux2
Type “help”, “Copyright”, “credits” or “license” for more information.
>>>
Python 2.7.10 (default, $ep 27 2015, 18:11:38) [GCC 5.1.1 20150422 (Red Hat 5.1.1-1)] on linux2
Type “help”, “Copyright”, “credits” or “license” for more information.
>>>
>>> print “Programming in Python!”
The result will be as given below
Programming in Python! >>>
b) Script from the Command Line
This method invokes the interpreter with a script parameter which begins the execution of the script and continues until the script is finished. When the script is finished, the Interpreter is no longer active. A Python script can be executed at command line by invoking the interpreter on your application, follows.For Unix/Linux it is
$python script .py or python% script . py
For Windows/Dos it is
C:>python script. py
Let us write a simple Python Program In a script. Python files have extension .py Type the foilowin source code In a first.py file.
print “Programming in Python!”
Now, try to run this Program as follows.
$ python hrst.py
This produces the following result:
Programming in Python!
Comments
Post a Comment