Getting Started with Python
3-
Phases in programming
1. Problem identification
2. Preparing algorithms and flow-charts
3. Coding the program using programming language
4. Translation
5. Debugging
6. Execution and testing
7. Documentation
I
1. Problem Identification
During this phase you will be able to identify the data involved
-
in processing, its type and quantity, formula to be used,
-
activities involved, and the output to be obtained
- -
2. Algorithm -
An algorithm may be defined as a finite sequence of
-
instructions to solve a problem. It is a step-by-step procedure
-
to solve a problem, where each step represents a specific task
to be carried out. -
-
[
Syntax is :
--
-Step 1: Start
-Step 2: Input var1,var2, ….
Step 3: Process -
Step 4: Output -
-
!Step 5: Stop
&
Variables - -
-
-
➔ First letter begin with Alpahabets or Underscore
-
➔ It do not start with Numbers -
- -
-
-
➔ Space,Special Symbols not allowed in Variables
-
-
-
X
#
2
2
↑
adm
X no
ab(123
#
Write an Algorithm to find sum of Two Numbers
Step 1 : Start Eat
-
↓
Sterz : Read a
,
b
Lend
ab/
Step3 : S
↓
= b
4+
↓
L
-
&
S = 13
StepS : Print S
↓
Ent
SHP5 : Stop
[Or)
Write an Algorithm to find area and perimeter of rectangle
Sp : Start A = 1 *5
Stepz : Read 1, b P = z(l+ b)
A 1 +b
SD3 : =
StpS : P= 2* (1+
b]
Print A P
Sp 5 : ,
StS : Stop
Write an Algorithm to find area and perimeter of circle
Write an Algorithm to find largest of two numbers
Sp1 : Start
Steve : Read a
, b
Steps : If a >b
Print" A is bigger"
eise
Punt" bi bisser"
Stell : Stop
Ent
#
y -
↓ LA's"I
F
I
-
Lut"
By "Y
,
v
op3
Flowchart -
Pictorial Representation of Algorithm is known as Flowchart
- - -
Flowchart Symbols -
1. Terminal: it is used to indicate the beginning (START) and
-
- ending (STOP) in the program logic flow .
-
-
2. Input / Output : -
-
3. Process: Asigning Values , Equations etc
-
-
a 85
= -
↑
-
4. Decision :It is used to indicate a point at which a decision
has to be made.
Rhombus
-
-
7. Flowlines : Flow lines with arrow heads are used to indicate
the flow of operation . -
-
&
Coding the program -
● The process of writing program instructions to solve a
-
-
problem is called coding .
- -
-
-
● The program written in any HLL is known as source code.
- -
- -
Eg: C, C++ , Python , Java etc
--- -
Translation -
● Translation is the process of converting a program written in
high level language into its equivalent version in machine
language - -
● During this step, the syntax errors of the program will be
displayed. -
#
#
-
Debugging
-
if
● Errors in Program is called Bug .
--
● Process of Detecting and Correcting an error is called
-
Debugging .
-
● In programming , their have 3 types of Errors –
- --
Syntax error - Syntax errors result when the rules or syntax of
- -
-
the programming language are not followed. ;
XLogical error - is due to improper planning of the program's
logic. -
S = b 853E
~Runtime error: An error occurred at run time due to
-
inappropriate data
510 2) =
=
4/4/2 =
Execution and Testing to -
upuffe &
- In
● When the compiled version of the program is formed, it
-
-
should be executed for testing.
● The purpose of testing is to determine whether the results
are correct.
-
Pseudocode
Pseudocode is a way to describe algorithms or program logic using
Ea mix of natural language and programming concepts, without
worrying about strict syntax rules.
Eg: --
# While loop
-
WHILE condition DO -
- -
# loop body -
END WHILE -
# For loop -
FOR each item IN collection DO
- -
- for
# process item
END FOR
Decomposition -
Decomposition is a fundamental programming principle where you
-
break down a complex problem into smaller, more manageable
subproblems (often implemented as functions or classes). This
-
approach makes code more organized, reusable, and easier to
understand.
E
def celsius_to_fahrenheit(celsius): -
"""Convert Celsius to Fahrenheit"""
return (celsius * 9/5) + 32
def fahrenheit_to_celsius(fahrenheit): -
"""Convert Fahrenheit to Celsius"""
return (fahrenheit - 32) * 5/9
O
-
FEATURES OF PYTHON
-
1. Simple & Readable Syntax -
Python code looks almost like plain English.
S
Uses indentation (whitespace) instead of curly braces ({}), enforcing
clean code structure. -
--
-
Perfect for beginners and experts alike.
FEATURES OF PYTHON
Huge Standard Library & Ecosystem -
• Comes with batteries included (built-in modules for file I/O, math,
-
-
networking, etc.).
• Third-party libraries for almost anything:
6
•
&
Data Science: Pandas, NumPy
•
-
AI/ML: TensorFlow, PyTorch
-
-
Saty
•
-
Web Dev: Django, Flask-
-
-
• Automation: Selenium, Requests
Sum
-
--
FEATURES OF PYTHON
Cross-Platform & Portable -
Works on Windows, macOS, Linux without changes.
- - -
Write once, run anywhere (like Java but simpler).
FEATURES OF PYTHON
4. Dynamically Typed (No Strict Variable Declarations)
--
No need to declare int, string, etc. int 9 , 31
;
Faster prototyping and flexible coding.
O5a =
b =
7
FEATURES OF PYTHON
-
Strong Community & Support -
Open-source & free (no licensing costs).
• Huge community (Stack Overflow, GitHub, PyPI).
• Used by tech giants (Google, Netflix, NASA, Instagram).
INTRODUCTION
Python is a high-level, object-oriented, interactive,
- -
general-purpose programming language which was developed by
- -
Guido van Rossum in 1991. It is used in web development, Artificial
- -
Intelligence, Machine Learning and mobile application development.
- -
-
Python is an interpreted
-
language as its programs are executed
by an interpreter. Thus, Python interpreter should be installed on
the computer system to write and run Python programs. Python
-
IDLE (Integrated Development and Learning Environment) provides
-
two working modes-interactive mode (popularly known as Python
Shell) and script mode.
-
[
X
-
-
-
-
-
[
Using Interactive (Python Shell window) mode, the Python commands
-
are directly typed at >>> (command prompt) and as soon as we press
-
the Enter key, the interpreter displays the result(s) immediately, which
is known as Displaying.
-
0
-
The drawback of interactive mode is that we cannot save the
commands that we type. This can be overcome using the script mode.
In order to switch over to script mode, click on the File menu option ->
New option or press the shortcut key Ctrl + N from the shell window.