Programming with Python High-Level Language
A programming language communicates • Python is a high-level language with
instructions to a machine to accomplish a English-like syntax, easy debugging, and
particular task. A programming language is used high productivity.
to create programs (i.e., a set of instructions) that
Portable
control the behaviour of a machine and/or to
express algorithms precisely. • Python is platform-independent (cross-
platform); its bytecode allows programs to
Introduction to Python
run on any OS without changes.
• Python is a general-purpose high-level
Object Oriented
programming language.
• Python was named after the British • Python supports multiple paradigms—
comedy show, Monty Python's Flying object-oriented, imperative, functional,
Circus at the National Research Institute
for Mathematics and Computer Science in •
and procedural programming.
OOP in Python uses Abstraction,
a m
•
the Netherlands.
Python programming language was
developed by Guido van Rossum in
Encapsulation,
r
Inheritance,
Polymorphism to simplify complex
problems.
a
and
•
February 1991.
IDLE is an Integrated Development Extensible:
m b
Environment. It is a platform where you can
write and run your programs.
•
g aPython can be extended with other zanguages
(like C/C++) to add new features.
Features of Python
Python is designed to be simple, readable, and
capable to handle complex problems with ease.
N a Embeddable:
• Python code/libraries can be embedded into
s h
Python syntax is easy and has fewer lines of code
as compared to other programming languages.
programs written in other languages.
Interpreted:
Easy
n e • Python uses an interpreter (PVM) to convert
D i•
•
Python is easy to learn with English-like
syntax, enabling quick and simple coding.
Supports solving complex problems
efficiently.
source code to bytecode and run on any
platform.
Extensive Library:
• Python offers rich libraries that simplify
Expressive coding and support fields like data science
and machine learning.
• Python’s easy syntax allows writing less
code to solve complex problems, making it Dynamically-Typed:
highly expressive.
• In Python, variable types don’t need to be
Free and Open Source declared; types can change during
runtime.
• Python is free, open-source, and
community-driven — you can use, modify,
and distribute it freely.
Page 1 of 3
Uses of Python Interactive Mode
• Web & Internet Development • Interactive Mode is the default Python IDLE
• Scientific & Numeric Computing mode where commands run immediately
• Desktop GUIs and show output.
• Software Development • The prompt '>>>' indicates it’s ready to
• Business Applications (ERP, e-commerce) accept commands.
Python Installation
• Python can be installed on Windows,
Linux, Unix, and Mac OS X.
• Download the latest Python 3 version from Script Mode
[Link]/downloads/
• Script Mode lets you write and save multiple
• Run the downloaded installer to set up
Python on your system. •
lines of code as a .py file.
a m
Open via Python IDLE: File > New File, write
code, save with .py extension.
•
r
Run script with Run > Run Module or press
a
F5; output shows in Python shell.
•
m b
Python Interactive Mode vs Script Mode
• Select “Install launcher for all users” and
“Add Python to PATH” options.
•
g aInteractive Mode runs one line of code at a
time and shows immediate results.
To exit, type exit().
•
to complete.
N a
Click “Install Now” and wait for installation
Restart your computer after installation to
• Use Script Mode for multiple lines or full
programs to run and debug all at once.
Chapter Recap
•
access Python IDLE.
s h
Click Start → select IDLE (Python 3.9) from
• An ordered set of instructions executed by a
computer to carry out a specific task is called
n
Shell. e
Recently Added apps to open Python IDLE
•
a program.
Python is a general-purpose high-level
programming language.
D i
Writing Python Programs using Different Modes
• It has two modes: Interactive Mode (Python
Shell) and Script Mode (file editor).
•
•
Python was developed by Guido van Rossum
in 1991.
Python is a free language as you can
download and install it on your computer
without paying any fee.
• Python is a platform-independent language.
Python programs can run on any platform
without making
• any changes to them.
• Python uses interpreter to convert the code
and run on any platform.
• Python libraries are the set of functions that
you can add to your program. They help to
make Python
• programs simple and easy. It reduces your
time to write long Python programs.
Page 2 of 3
• Python is a dynamically typed language. It
means that while programming you do not
need to declare
• the type of variables before their use.
• Python Shell is an interpreter for the Python
language.
• Interactive mode and Script mode are the two
modes in Python where you can write
instructions.
• Interactive mode allows you to write a single
line of code and run the instruction in the shell
itself.
• Script mode allows you to write multiple lines
of code and run the module.
a m
a r
m b
g a
N a
s h
n e
D i
Page 3 of 3