Python is a high-level, structured, open-source programming language that can be used for a wide variety of programming tasks. Python was created by Guido Van Rossum in the early 1990s; its following has grown steadily and interest has increased markedly in the last few years or so. It is named after Monty Python's Flying Circus comedy program.
Python within itself is an interpreted programming language that is automatically compiled into bytecode before execution It is also a dynamically typed language that includes (but does not require one to use) object-oriented features and constructs.The most unusual aspect of Python is that whitespace is significant; instead of block delimiters (braces → "{}" in the C family of languages), indentation is used to indicate where blocks begin and end.
Another great feature of Python is its availability for all platforms. Python can run on Microsoft Windows, Macintosh and all Linux distributions with ease. This makes the programs very portable, as any program written for one platform can easily be used on another.
Python provides a powerful assortment of built-in types (e.g., lists, dictionaries and strings), a number of built-in functions, and a few constructs, mostly statements. For example, loop constructs that can iterate over items in a collection instead of being limited to a simple range of integer values. Python also comes with a powerful standard library, which includes hundreds of modules to provide routines for a wide variety of services including regular expressions and TCP/IP sessions.
Python is used and supported by a large Python Community that exists on the Internet. The mailing lists and news groups like the tutor list actively support and help new python programmers. While they discourage doing homework for you, they are quite helpful and are populated by the authors of many of the Python textbooks currently available on the market.
Easy-to-learn : Python is easy to learn and use. It is developer-friendly and high level programming language.
Easy-to-read : Python code is more clearly defined and visible to the eyes.
Easy-to-maintain : Python's source code is fairly easy-to-maintain.
Interactive Mode : Python has support for an interactive mode which allows interactive testing and debugging.
Free and Open Source: Python language is freely available at offical web address.The source-code is also available. Therefore it is open source.
Portable: Python can run on a wide variety of hardware platforms and has the same interface on all platforms.
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.
Object-Oriented Language : Python supports object oriented language and concepts of classes and objects come into existence.
Large Standard Library: Python has a large and broad library and prvides rich set of module and functions for rapid application development.
GUI Programming: Python supports GUI applications that can be created and ported to many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and the X Window system of Unix.
Scalable: Python provides a better structure and support for large programs than shell scripting.
Integrated: It can be easily integrated with languages like C, C++, JAVA etc.
>>> print("Hello World!")
Hello World!
>>> print("Hello World!")
Hello World!
>>> 2+6
8
Open your favorite text editor (e.g., vi, Notepad, or the IDLE editor),type the following statements into a new text file named script1.py, and save it in yourworking code directory. For linux write (#!/usr/local/bin/python) at the beginning.
print(“Hello User!”)
print(“Welcome to Python Easy!”)
print(2 ** 6)
x = 'Python'
print(x * 3) # String repetition
Once You have saved the file you can run it with command window. Move to the directory in which you have saved the script. Then type python and then the file name with .py extension to execute the scripts. You will get the following result.
The indentation rule may seem unusual at first glance to programmers accustomed to C-like languages, but it is a deliberate feature of Python, and it’s one of the main ways that Python almost forces programmers to produce uniform, regular, and readability.
if x:
if y:
statement1
else:
statement2
Nested statements are blocked and associated by their physical indentation(without braces).