INTRODUCTION TO PYTHON
Python
is a high-level, interpreted, general-purpose, dynamic programming language.
Python possesses a property of code termed reusability. The syntax of python
programs can express concepts in fewer lines as compared to programs in C, C++
and JAVA.
Python can be used in multiple programming
styles, including Object-Oriented, Functional programming, Procedural
Programming and Imperative styles. It also supports automatic memory management
and has a large standard library and innumerous set of third party libraries.
Python can be used on almost every operating system because its interpreter is
available for many operating systems. It is a free and open- source software(Open-source
software is a kind of computer software in which the source code of the
software is made public, i.e., the copyright holder gives rights to everyone to
read, change and distribute the code for any purpose).
KEY FEATURES OF PYTHON
·
The code
written in Python is automatically compiled to byte code and executed.
·
Python can
be used as a scripting language, as a language for implementing web
applications, etc.
·
Extending
Python with C or C++ can help in the performance of intensive tasks where speed
of execution is a key criterion.
·
Python
supports many features such as nested code blocks, functions, classes, modules
and packages.
·
Python
makes use of an object-oriented programming approach.
·
It has
many built-in datatypes: strings, lists, tuples, dictionaries, etc.
·
It
supports many control statements such as if, if-else, if-elif-else, while,
iterative, for, etc.
·
It allows
for easier programming with the use of functions, classes, modules and
packages.
IDLE
IDLE is Python’s
Integrated Development and Learning Environment. It has the following features:
·
Coded in
100% pure Python, using the tKinter GUI toolkit.
·
Cross-platform:
Works mostly the same on Windows, Unix, and MacOS.
·
Python
shell window (interactive interpreter) with colorizing of code input, output,
and error messages.
·
It is a
multi-window text editor with multiple undo, Python Colorizing, smart indent,
call tips, auto completion, and other features.
·
Search
within any window, replace within editor windows, and search through multiple
files.
·
Debugger
with persistent breakpoints, stepping, and viewing of global and local
namespaces.
·
Configuration,
browsers, and other dialogs.
IDLE
has two main window types, the Shell window and the Editor windows. It is
possible to have multiple editor windows simultaneously. On windows and Linux,
each has its own top menu.
PYTHON INTERPRETER
An interpreter is a program
that reads and executes code. This includes source code, pre-compiled code, and
scripts. It converts a high-level programming language into machine code.
Unlike a compiler that simply converts the source code to machine code, an
interpreter can be run directly as an executable program.
Python is referred to as an
interpreted language. This means that each line of code is executed one by one.
The reason why Python is termed as a n interpreted language is that the
compiler in Python does relatively less work than an interpreter or in a
compiled language like C.
WRITING AND EXECUTING PYTHON
SCRIPTS
First of all download the
Python Installer from the link:
http://www.Python.org/downloads/
The different ways in which we can we can run a Python script are:
1. Interactive Mode
2. Command Line
3. Text Editor
4. IDE (Integrated
Development Environment)
Interactive
Mode
In this mode you can run your script
line by line in a sequence. To enter in an interactive mode you will have to
open Command Prompt on tour windows machine and type ‘python’ and press Enter.
|
>>>
print(‘Hello
World’) Hello
World >>> 2 + 5 7 >>> print(‘This
is a Python Script’) This is a Python Script |
Comments
Post a Comment