SlideShare a Scribd company logo
2
Most read
3
Most read
12
Most read
PYTHON PROGRAMMING
ADDITION OF TWO NUMBERS
Algorithm
1. START
2. READ A,B
3. LET SUM = A + B
4. PRINT SUM
5. STOP
START
Flow chart
READ A,B
LET SUM = A + B
PRINT SUM
STOP
Python program
Output
# Sum of two numbers
a=input ('Enter first number')
b=input ('Enter second number')
sum=a+b
print ('Sum of given numbers =',sum)
Enter first number10
Enter second number8
('Sum of given numbers =', 18)
SUBSTRACTION OF TWO NUMBERS
Algorithm
1. START
2. READ A, B
3. LET DIFF = A - B
4. PRINT DIFF
5. STOP
START
Flow chart
READ A,B
LET DIFF = A - B
PRINT DIFF
STOP
Python program
Output
# Difference between two numbers
a=input ('Enter first number')
b=input ('Enter second number')
diff=a-b
print (‘Difference of given numbers =‘,diff)
Enter first number10
Enter second number5
(‘Difference of given numbers =', 5)
AVERAGE OF THREE NUMBERS
Algorithm
1. START
2. READ A, B, C
3. LET AVG = (A+B+C) / 3
4. PRINT AVG
5. STOP
START
Flow chart
READ A,B, C
LET AVG = (A+B+C) / 3
PRINT AVG
STOP
Python program
Output
# Average of three numbers
a=input ('Enter first number')
b=input ('Enter second number')
C=input (‘Enter third number’)
avg=(a+b+c)/3
print (‘Average of three numbers =’,avg)
Enter first number10
Enter second number5
Enter third number15
(‘Average of three numbers =',10)
VOLUME OF CYLINDER
Algorithm
1. START
2. READ r, h
3. LET VOL = 3.14*r*r*h
4. PRINT VOL
5. STOP
START
Flow chart
READ r, h
LET VOL = 3.14*r*r*h
PRINT VOL
STOP
Python program
Output
# Volume of cylinder
r=input ('Enter radius')
h=input ('Enter height')
volume = 3.14*r*r*h
print (‘Volume of cylinder=’,volume)
Enter radius5
Enter height10
('Volume of cylinder =', 785.0)
VOLUME OF CUBE
Algorithm
1. START
2. READ a
3. LET VOL = a*a*a
4. PRINT VOL
5. STOP
START
Flow chart
READ a
LET VOL = a*a*a
PRINT VOL
STOP
Python program
Output
# Volume of cube
a=input ('Enter one side of cube')
volume = a*a*a
print (‘Volume of cube=’,volume)
Enter one side of cube5
('Volume of cube =', 125.0)
CONVERSION OF CELSIUS TO FAHRENHEIT
Algorithm
1. START
2. READ C
3. LET F = (C*9/5) + 32
4. PRINT F
5. STOP
START
Flow chart
READ C
LET F = (C*9/5) + 32
PRINT F
STOP
Python program
Output
# Convert Celsius to Fahrenheit
c=input ('Enter heat in degree Celsius')
f=(c*9/5)+32
print (‘Heat in Fahrenheit scale =’,f)
Enter heat in degree Celsius37
(‘Heat in Fahrenheit scale =’,98)
CONVERSION OF FAHRENHEIT TO CELSIUS
Algorithm
1. START
2. READ F
3. LET C = (F – 32)*5/9
4. PRINT C
5. STOP
START
Flow chart
READ F
LET C = (F – 32)*5/9
PRINT C
STOP
Python program
Output
# Convert Fahrenheit to Celsius
f=input ('Enter heat in Fahrenheit')
c=(f-32)*5/9
print (‘Heat in Celsius scale =’,c)
Enter heat in Fahrenheit98
(‘Heat in Celsius scale =’,37)
LARGEST OF THREE NUMBERS
Algorithm
1. START
2. READ A, B, C
3. IF (A>B):
IF (A>C):
LARGEST=A
ELSE:
LARGEST=C
ELSE:
IF (B>C):
LARGEST=B
ELSE :
LARGEST=C
4. PRINT LARGEST
5. STOP
START
Flow chart
READ A, B, C
LARGEST = C
PRINT LARGEST
STOP
IF (A>B)
IF (A>C) IF (B>C)
LARGEST = A LARGEST = B
NOYES
YES
YES
NONO
Python program
Output
# Largest of three numbers
a=input (‘Enter first number’)
b=input (‘Enter second number’)
c=input (‘Enter third number’)
if (a>b):
if (a>c):
largest=a
else:
largest=b
else:
if (b>c):
largest=b
else:
largest=c
print ('Largest of three numbers is',largest)
Enter first number 5
Enter second number 6
Enter third number 88
('Largest of three numbers is', 88)
CHARACTER NAME OF THE DAY
Algorithm
1. START
2. READ N
3. IF (N==1): PRINT SUNDAY
ELIF (N==2): PRINT MONDAY
ELIF (N==3): PRINT TUESDAY
ELIF (N==4): PRINT WEDNESDAY
ELIF (N==5): PRINT THURSDAY
ELIF (N==6): PRINT FRIDAY
ELIF (N==7): PRINT SATURDAY
ELSE: PRINT INVALID DAY NUMBER
4. STOP
START
Flow chart
READ N
IF (N==1)
NOYES
IF (N==2)
IF (N==3)
IF (N==4)
IF (N==5)
IF (N==6)
IF
PRINT
SUNDAY
PRINT
MONDAY
PRINT
TUESDAY
PRINT
WEDNESDAY
PRINT
THURSDAY
PRINT
FRIDAY
PRINT
SATURDAY
CHARACTER NAME OF THE DAY
Algorithm
1. START
2. READ N
3. IF (N==1): PRINT SUNDAY
ELIF (N==2): PRINT MONDAY
ELIF (N==3): PRINT TUESDAY
ELIF (N==4): PRINT WEDNESDAY
ELIF (N==5): PRINT THURSDAY
ELIF (N==6): PRINT FRIDAY
ELIF (N==7): PRINT SATURDAY
ELSE: PRINT INVALID DAY NUMBER
4. STOP
Flow chart
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
Python program
Output
# Character name of the day
n=input('Enter the day number')
if (n==1):
print ('Sunday')
elif (n==2):
print ('Monday')
elif (n==3):
print ('Tuesday')
elif (n==4):
print ('Wednesday')
elif (n==5):
print ('Thursday')
elif (n==6):
print ('Friday')
elif (n==7):
print ('Saturday')
else:
print ('Not a valid day number')
Enter the day number2
Monday
ODD OR EVEN
Algorithm
1. START
2. READ N
3. IF ( N%2 == 0):
PRINT EVEN
ELSE
PRINT ODD
4. STOP
START
Flow chart
READ N
STOP
Python program
Output
# To find given number is odd or even number
n=input (‘Enter number’)
if (n%2==0):
print (‘Even number’)
else:
print (‘Odd number’)
Enter nuber5
Odd number
IF
(N%2==0
PRINT ODDPRINT EVEN
TO PRINT N NATURAL NUMBERS
Algorithm
1. START
2. READ N
3. LET i=1
4. WHILE (i <= N):
PRINT i
LET I = i+1
5. STOP
START
Flow chart
READ N
STOPPython program
Output
# To print N natural numbers
n=input (‘Enter Limit’)
i=1
While (i<=n):
print i
i = i+1
Enter Limit3
1
2
3
WHILE
(i<=n)
LET i = 1
PRINT i
LET i = i + 1
YES
NO
FACTORIAL OF A NUMBER
Algorithm
1. START
2. READ N
3. LET fact =1
4. FOR x IN RANGE (1, N+1):
fact = fact * x
5. PRINT fact
6. STOP
START
Flow chart
READ N
STOPPython program
Output
# To print factorial of a number
n=input (‘Enter number’)
fact=1
For x in range (1, n+1):
fact=fact*x
Print (‘Factorial of given number is’, fact)
Enter number5
Factorial of given number is 120
for x
in range
(1, N+1)
LET fact = 1
LET fact = fact * x
YES
NO
PRINT fact

More Related Content

PPTX
Introduction to programming
PPTX
PDF
Python programming : Arrays
PDF
Intro to Python for Non-Programmers
PPT
PPTX
6-Python-Recursion PPT.pptx
PPTX
Introduction to stack
PDF
Introduction to NumPy (PyData SV 2013)
Introduction to programming
Python programming : Arrays
Intro to Python for Non-Programmers
6-Python-Recursion PPT.pptx
Introduction to stack
Introduction to NumPy (PyData SV 2013)

What's hot (20)

PPT
Python GUI Programming
PPT
Memory allocation in c
PDF
design and analysis of algorithm Lab files
PPTX
MatplotLib.pptx
PPTX
Python
PPTX
Python Programming Essentials - M8 - String Methods
PPT
Infix prefix postfix
PDF
Python strings
ODP
Python Modules
PPTX
Mixing C++ & Python II: Pybind11
PPTX
Python Lambda Function
PPTX
Intro to Python Programming Language
PPTX
Object oriented programming in python
PPTX
Tuple in python
PDF
First order logic
PDF
Let’s Learn Python An introduction to Python
PPTX
Python- Regular expression
PDF
Python Unit 3 - Control Flow and Functions
Python GUI Programming
Memory allocation in c
design and analysis of algorithm Lab files
MatplotLib.pptx
Python
Python Programming Essentials - M8 - String Methods
Infix prefix postfix
Python strings
Python Modules
Mixing C++ & Python II: Pybind11
Python Lambda Function
Intro to Python Programming Language
Object oriented programming in python
Tuple in python
First order logic
Let’s Learn Python An introduction to Python
Python- Regular expression
Python Unit 3 - Control Flow and Functions
Ad

Similar to Python programs - PPT file (Polytechnics) (20)

PDF
Python programs - first semester computer lab manual (polytechnics)
PDF
xii cs practicals
DOCX
Python Laboratory Programming Manual.docx
PPTX
Pa1 wednesday flow_chart
DOC
Programada chapter 4
PDF
Data Structure and Algorithms (DSA) with Python
PPT
our c prog work
PPT
Unit 3 Foc
PDF
L- 14. 0 Algorithm_Flowchart_Example.pdf
PPTX
Pa1 flow chart
PPTX
Pa1 flow chart
PPTX
Programming Fundamentals in Python - Sequence Structure
PDF
xii cs practicals class 12 computer science.pdf
PPTX
Programming fundamentals lecture 4
PPT
Algorithmsandflowcharts1
PPT
Algorithms and flowcharts1
PPT
Algorithmsandflowcharts1
PPTX
Python Programming Full Course || Beginner to Intermediate || Bangla (বাংলা) ...
PDF
1153 algorithms%20and%20flowcharts
PPTX
Python programming workshop
Python programs - first semester computer lab manual (polytechnics)
xii cs practicals
Python Laboratory Programming Manual.docx
Pa1 wednesday flow_chart
Programada chapter 4
Data Structure and Algorithms (DSA) with Python
our c prog work
Unit 3 Foc
L- 14. 0 Algorithm_Flowchart_Example.pdf
Pa1 flow chart
Pa1 flow chart
Programming Fundamentals in Python - Sequence Structure
xii cs practicals class 12 computer science.pdf
Programming fundamentals lecture 4
Algorithmsandflowcharts1
Algorithms and flowcharts1
Algorithmsandflowcharts1
Python Programming Full Course || Beginner to Intermediate || Bangla (বাংলা) ...
1153 algorithms%20and%20flowcharts
Python programming workshop
Ad

More from SHAMJITH KM (20)

PDF
Salah of the Prophet (ﷺ).pdf
PPTX
Construction Materials and Engineering - Module IV - Lecture Notes
PPTX
Construction Materials and Engineering - Module III - Lecture Notes
PPTX
Construction Materials and Engineering - Module II - Lecture Notes
PPTX
Construction Materials and Engineering - Module I - Lecture Notes
DOCX
Computing fundamentals lab record - Polytechnics
DOCX
Concrete lab manual - Polytechnics
DOCX
Concrete Technology Study Notes
PDF
നബി(സ)യുടെ നമസ്കാരം - രൂപവും പ്രാര്ത്ഥനകളും
DOCX
Design of simple beam using staad pro - doc file
PDF
Design of simple beam using staad pro
PDF
Python programming Workshop SITTTR - Kalamassery
PDF
Analysis of simple beam using STAAD Pro (Exp No 1)
PDF
Theory of structures I - STUDENT NOTE BOOK (Polytechnics Revision 2015)
PDF
Theory of structures II - STUDENT NOTE BOOK (Polytechnics Revision 2015)
PDF
CAD Lab model viva questions
PPTX
Brain Computer Interface (BCI) - seminar PPT
PDF
Surveying - Module iii-levelling only note
PDF
Surveying - Module II - compass surveying
PDF
Surveying - Module I - Introduction to surveying
Salah of the Prophet (ﷺ).pdf
Construction Materials and Engineering - Module IV - Lecture Notes
Construction Materials and Engineering - Module III - Lecture Notes
Construction Materials and Engineering - Module II - Lecture Notes
Construction Materials and Engineering - Module I - Lecture Notes
Computing fundamentals lab record - Polytechnics
Concrete lab manual - Polytechnics
Concrete Technology Study Notes
നബി(സ)യുടെ നമസ്കാരം - രൂപവും പ്രാര്ത്ഥനകളും
Design of simple beam using staad pro - doc file
Design of simple beam using staad pro
Python programming Workshop SITTTR - Kalamassery
Analysis of simple beam using STAAD Pro (Exp No 1)
Theory of structures I - STUDENT NOTE BOOK (Polytechnics Revision 2015)
Theory of structures II - STUDENT NOTE BOOK (Polytechnics Revision 2015)
CAD Lab model viva questions
Brain Computer Interface (BCI) - seminar PPT
Surveying - Module iii-levelling only note
Surveying - Module II - compass surveying
Surveying - Module I - Introduction to surveying

Recently uploaded (20)

PPTX
Lecture Notes Electrical Wiring System Components
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
additive manufacturing of ss316l using mig welding
DOCX
573137875-Attendance-Management-System-original
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT
Mechanical Engineering MATERIALS Selection
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Construction Project Organization Group 2.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
Sustainable Sites - Green Building Construction
Lecture Notes Electrical Wiring System Components
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Foundation to blockchain - A guide to Blockchain Tech
Operating System & Kernel Study Guide-1 - converted.pdf
additive manufacturing of ss316l using mig welding
573137875-Attendance-Management-System-original
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Mechanical Engineering MATERIALS Selection
CYBER-CRIMES AND SECURITY A guide to understanding
Construction Project Organization Group 2.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Lesson 3_Tessellation.pptx finite Mathematics
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Internet of Things (IOT) - A guide to understanding
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Sustainable Sites - Green Building Construction

Python programs - PPT file (Polytechnics)

  • 2. ADDITION OF TWO NUMBERS Algorithm 1. START 2. READ A,B 3. LET SUM = A + B 4. PRINT SUM 5. STOP START Flow chart READ A,B LET SUM = A + B PRINT SUM STOP Python program Output # Sum of two numbers a=input ('Enter first number') b=input ('Enter second number') sum=a+b print ('Sum of given numbers =',sum) Enter first number10 Enter second number8 ('Sum of given numbers =', 18)
  • 3. SUBSTRACTION OF TWO NUMBERS Algorithm 1. START 2. READ A, B 3. LET DIFF = A - B 4. PRINT DIFF 5. STOP START Flow chart READ A,B LET DIFF = A - B PRINT DIFF STOP Python program Output # Difference between two numbers a=input ('Enter first number') b=input ('Enter second number') diff=a-b print (‘Difference of given numbers =‘,diff) Enter first number10 Enter second number5 (‘Difference of given numbers =', 5)
  • 4. AVERAGE OF THREE NUMBERS Algorithm 1. START 2. READ A, B, C 3. LET AVG = (A+B+C) / 3 4. PRINT AVG 5. STOP START Flow chart READ A,B, C LET AVG = (A+B+C) / 3 PRINT AVG STOP Python program Output # Average of three numbers a=input ('Enter first number') b=input ('Enter second number') C=input (‘Enter third number’) avg=(a+b+c)/3 print (‘Average of three numbers =’,avg) Enter first number10 Enter second number5 Enter third number15 (‘Average of three numbers =',10)
  • 5. VOLUME OF CYLINDER Algorithm 1. START 2. READ r, h 3. LET VOL = 3.14*r*r*h 4. PRINT VOL 5. STOP START Flow chart READ r, h LET VOL = 3.14*r*r*h PRINT VOL STOP Python program Output # Volume of cylinder r=input ('Enter radius') h=input ('Enter height') volume = 3.14*r*r*h print (‘Volume of cylinder=’,volume) Enter radius5 Enter height10 ('Volume of cylinder =', 785.0)
  • 6. VOLUME OF CUBE Algorithm 1. START 2. READ a 3. LET VOL = a*a*a 4. PRINT VOL 5. STOP START Flow chart READ a LET VOL = a*a*a PRINT VOL STOP Python program Output # Volume of cube a=input ('Enter one side of cube') volume = a*a*a print (‘Volume of cube=’,volume) Enter one side of cube5 ('Volume of cube =', 125.0)
  • 7. CONVERSION OF CELSIUS TO FAHRENHEIT Algorithm 1. START 2. READ C 3. LET F = (C*9/5) + 32 4. PRINT F 5. STOP START Flow chart READ C LET F = (C*9/5) + 32 PRINT F STOP Python program Output # Convert Celsius to Fahrenheit c=input ('Enter heat in degree Celsius') f=(c*9/5)+32 print (‘Heat in Fahrenheit scale =’,f) Enter heat in degree Celsius37 (‘Heat in Fahrenheit scale =’,98)
  • 8. CONVERSION OF FAHRENHEIT TO CELSIUS Algorithm 1. START 2. READ F 3. LET C = (F – 32)*5/9 4. PRINT C 5. STOP START Flow chart READ F LET C = (F – 32)*5/9 PRINT C STOP Python program Output # Convert Fahrenheit to Celsius f=input ('Enter heat in Fahrenheit') c=(f-32)*5/9 print (‘Heat in Celsius scale =’,c) Enter heat in Fahrenheit98 (‘Heat in Celsius scale =’,37)
  • 9. LARGEST OF THREE NUMBERS Algorithm 1. START 2. READ A, B, C 3. IF (A>B): IF (A>C): LARGEST=A ELSE: LARGEST=C ELSE: IF (B>C): LARGEST=B ELSE : LARGEST=C 4. PRINT LARGEST 5. STOP START Flow chart READ A, B, C LARGEST = C PRINT LARGEST STOP IF (A>B) IF (A>C) IF (B>C) LARGEST = A LARGEST = B NOYES YES YES NONO
  • 10. Python program Output # Largest of three numbers a=input (‘Enter first number’) b=input (‘Enter second number’) c=input (‘Enter third number’) if (a>b): if (a>c): largest=a else: largest=b else: if (b>c): largest=b else: largest=c print ('Largest of three numbers is',largest) Enter first number 5 Enter second number 6 Enter third number 88 ('Largest of three numbers is', 88)
  • 11. CHARACTER NAME OF THE DAY Algorithm 1. START 2. READ N 3. IF (N==1): PRINT SUNDAY ELIF (N==2): PRINT MONDAY ELIF (N==3): PRINT TUESDAY ELIF (N==4): PRINT WEDNESDAY ELIF (N==5): PRINT THURSDAY ELIF (N==6): PRINT FRIDAY ELIF (N==7): PRINT SATURDAY ELSE: PRINT INVALID DAY NUMBER 4. STOP START Flow chart READ N IF (N==1) NOYES IF (N==2) IF (N==3) IF (N==4) IF (N==5) IF (N==6) IF PRINT SUNDAY PRINT MONDAY PRINT TUESDAY PRINT WEDNESDAY PRINT THURSDAY PRINT FRIDAY PRINT SATURDAY
  • 12. CHARACTER NAME OF THE DAY Algorithm 1. START 2. READ N 3. IF (N==1): PRINT SUNDAY ELIF (N==2): PRINT MONDAY ELIF (N==3): PRINT TUESDAY ELIF (N==4): PRINT WEDNESDAY ELIF (N==5): PRINT THURSDAY ELIF (N==6): PRINT FRIDAY ELIF (N==7): PRINT SATURDAY ELSE: PRINT INVALID DAY NUMBER 4. STOP Flow chart NO NO NO NO NO NO YES YES YES YES YES YES
  • 13. Python program Output # Character name of the day n=input('Enter the day number') if (n==1): print ('Sunday') elif (n==2): print ('Monday') elif (n==3): print ('Tuesday') elif (n==4): print ('Wednesday') elif (n==5): print ('Thursday') elif (n==6): print ('Friday') elif (n==7): print ('Saturday') else: print ('Not a valid day number') Enter the day number2 Monday
  • 14. ODD OR EVEN Algorithm 1. START 2. READ N 3. IF ( N%2 == 0): PRINT EVEN ELSE PRINT ODD 4. STOP START Flow chart READ N STOP Python program Output # To find given number is odd or even number n=input (‘Enter number’) if (n%2==0): print (‘Even number’) else: print (‘Odd number’) Enter nuber5 Odd number IF (N%2==0 PRINT ODDPRINT EVEN
  • 15. TO PRINT N NATURAL NUMBERS Algorithm 1. START 2. READ N 3. LET i=1 4. WHILE (i <= N): PRINT i LET I = i+1 5. STOP START Flow chart READ N STOPPython program Output # To print N natural numbers n=input (‘Enter Limit’) i=1 While (i<=n): print i i = i+1 Enter Limit3 1 2 3 WHILE (i<=n) LET i = 1 PRINT i LET i = i + 1 YES NO
  • 16. FACTORIAL OF A NUMBER Algorithm 1. START 2. READ N 3. LET fact =1 4. FOR x IN RANGE (1, N+1): fact = fact * x 5. PRINT fact 6. STOP START Flow chart READ N STOPPython program Output # To print factorial of a number n=input (‘Enter number’) fact=1 For x in range (1, n+1): fact=fact*x Print (‘Factorial of given number is’, fact) Enter number5 Factorial of given number is 120 for x in range (1, N+1) LET fact = 1 LET fact = fact * x YES NO PRINT fact