2. Introduction to Python
• Python is an interpreted high-level programming language for general
purpose programming that employs an object oriented approach. It can
model real-world entities. It is also dynamically typed because it carries
out type-checking at runtime. Python IDLE (Integrated Development
Environment) executes instructions one line at a time allows to use as a
calculator.
• It is used by many of the most highly productive professional
programmers. Python is used for software development at companies and
organizations such as Google, Yahoo, CERN, Industrial Light and Magic, and
NASA. Python is often used as the scripting language for video games.
Guido Van Rossum
3. Integrated Development Environment(IDLE)
• We can run simple Python expression and statements in an
interactive programming environment called the shell. The easiest
way to open a Python shell is to launch IDLE.
• This is an integrated program development environment that comes
with the Python installation.
To get the IDLE: start -> All Programs -> IDLE from Python.
4. • It displays the Python shell window:
• The symbol ‘>>>’ called a shell prompt which indicates that the
interpreter is ready and waits for user to enter a Python
command. Short cut keys Purpose
Ctrl+c Copy the selected text
Ctrl+x Cut the selected text
Ctrl+v Paste
Ctrl+z Undo the last key strokes
Ctrl+shift+z Redo the last key strokes
F5 Run the Module
Ctrl+D / ctrl+Q To come out from the Python
5. • IDLE allows the programmer to save programs in files and load them into a
shell for testing.
• Steps:
1. Select the option New File from File menu on the shell window.
6. 2. In the new window, enter the Python expression or statements and save the
file by selecting File->Save. Use a ‘.py’ extension.
3. To run this file, select ‘Run Module’ or F5 from the ‘Run’ Menu.
Compilation Process of Python program:
• Python first compiles the source code (.py) into a format known as byte
code. Compiled code is usually stored in .pyc files and is regenerated when the
source code is updated or when otherwise necessary.
• The bytecode (.pyc file) is loaded into the python runtime and
interpreted by a Python Virtual Machine.
• Each time an interpreted program is run, the interpreter must convert
source code into machine code and also pull in the runtime libraries. It compiles
to bytecode the first time it executes a file.