Home | | Problem Solving and Python Programming | Introduction to Python

Features, Applications, interpreter, Modes - Introduction to Python | Problem Solving and Python Programming : Data, Expressions, Statements

Chapter: Problem Solving and Python Programming : Data, Expressions, Statements

Introduction to Python

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language.

INTRODUCTION TO PYTHON:

 

Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language.

 

It was created by Guido van Rossum during 1985- 1990.

 

Python got its name from “Monty Python’s flying circus”. Python was released in the year 2000.

 

v   Python is interpreted: Python is processed at runtime by the interpreter. You do not need to compile your program before executing it.

 

v   Python is Interactive: You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.

 

v   Python is Object-Oriented: Python supports Object-Oriented style or technique of programming that encapsulates code within objects.

 

v   Python is a Beginner's Language: Python is a great language for the beginner- level programmers and supports the development of a wide range of applications.

 

Python Features:

 

v Easy-to-learn: Python is clearly defined and easily readable. The structure of the program is very simple. It uses few keywords.

 

v   Easy-to-maintain: Python's source code is fairly easy-to-maintain.

 

v   Portable: Python can run on a wide variety of hardware platforms and has the same interface on all platforms.

 

v   Interpreted: Python is processed at runtime by the interpreter. So, there is no need to compile a program before executing it. You can simply run the program.

 

v   Extensible: Programmers can embed python within their C,C++,Java script ,ActiveX, etc.

 

v   Free and Open Source: Anyone can freely distribute it, read the source code, and edit it.

 

v   High Level Language: When writing programs, programmers concentrate on solutions of the current problem, no need to worry about the low level details.

 

v   Scalable: Python provides a better structure and support for large programs than shell scripting.

 

Applications

 

v   Bit Torrent file sharing

v   Google search engine, Youtube

v   Intel, Cisco, HP, IBM

v   i–Robot

v   NASA

v   Facebook, Drop box

 

Python interpreter:

 

Interpreter: To execute a program in a high-level language by translating it one line at a time.

 

Compiler: To translate a program written in a high-level language into a low-level language all at once, in preparation for later execution.


 

MODES OF PYTHON INTERPRETER:

 

Python Interpreter is a program that reads and executes Python code. It uses 2 modes of Execution.

 

1.              Interactive mode

2.              Script mode

 

1. Interactive mode:

 

v   Interactive Mode, as the name suggests, allows us to interact with OS.

v   When we type Python statement, interpreter displays the result(s) immediately.

 

Advantages:

v   Python, in interactive mode, is good enough to learn, experiment or explore.

v   Working in interactive mode is convenient for beginners and for testing small pieces of code.

 

Drawback:

v   We cannot save the statements and have to retype all the statements once again to re-run them.

 

In interactive mode, you type Python programs and the interpreter displays the result:

>>>     1 + 1

2

The chevron, >>>, is the prompt the interpreter uses to indicate that it is ready for you to enter code. If you type 1 + 1, the interpreter replies 2.

>>>     print ('Hello, World!')

Hello, World!

This is an example of a print statement. It displays a result on the screen. In this case, the result is the words.


 

2. Script mode:

 

v   In script mode, we type python program in a file and then use interpreter to execute the content of the file.

 

v   Scripts can be saved to disk for future use. Python scripts have the extension .py, meaning that the filename ends with .py

 

v   Save the code with filename.py and run the interpreter in script mode to execute the script.


 

Integrated Development Learning Environment (IDLE):

v   Is a graphical user interface which is completely written in Python.

v   It is bundled with the default implementation of the python language and also comes with optional part of the Python packaging.

 

Features of IDLE:

Multi-window text editor with syntax highlighting.

v   Auto completion with smart indentation.

Python shell to display output with syntax highlighting.


Tags : Features, Applications, interpreter, Modes , Problem Solving and Python Programming : Data, Expressions, Statements
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
Problem Solving and Python Programming : Data, Expressions, Statements : Introduction to Python | Features, Applications, interpreter, Modes

Related Topics

Problem Solving and Python Programming : Data, Expressions, Statements


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.