P NABI RASOOL Information Technology
Lab-1: Write a Python Program basic calculator operations
AIM: python program for basic calculator operations.
Algorithm:
Step1: START
Step2: Input num1, num2
Step3: add num1, num2 into sum
Step4: subtract num1, num2 into sub
Step5: Multiplication of num1, num2 into Mul
Step6: Division of num1, num2 into div
Step7: Floor of num1, num2 into flo
Step8: Modules of num1, num2 into mod
Step9: Exponent of num1, num2 into Exp
Step10: print sum
Step11: print sub
Step12: print Mul
Step13: print Div
Step14: print Flo
Step15: print Mod
Step16: print Exp
Step17: STOP
RGUKT R K Valley
P NABI RASOOL Information Technology
FlowChart
RGUKT R K Valley
P NABI RASOOL Information Technology
Python Programe:
Output
RGUKT R K Valley
P NABI RASOOL Information Technology
Lab-2: Write a Python Program to compare three numbers
AIM: python program for compare three numbers.
Algorithm:
Step1: START
Step2: Input three numbers: num1, num2 and num3
Step3: if num1==num2 and num2==num3
Print Given three numbers are equal
Step4: Else if num1>num2 and num1>num3
Print num1 is big
If num2>num3 Print num3 is small
Else Print num2 is small
Step5: Else if num2>num1 and num2>num3
Print num2 is big
If num1>num3 Print num3 is small
Else Print num1 is small
Step5: Else
Print num3 is big
If num1>num2 Print num2 is small
Else Print num1 is small
Step6: Stop
RGUKT R K Valley
P NABI RASOOL Information Technology
FlowChart
RGUKT R K Valley
P NABI RASOOL Information Technology
Python Programe:
Output
RGUKT R K Valley
P NABI RASOOL Information Technology
Lab-3: Write a Python Program to find given year is leap year or not
AIM: python program to find leap year.
Algorithm:
Step1: START
Step2: Input year
Step3: if (year%4==0 and year%100! =0) or year%400==0
Print Given year is leap year
Step4: Else
Print Given year is not a leap year
Step5: Stop
FlowChart
RGUKT R K Valley
P NABI RASOOL Information Technology
Python Programe:
Output
Lab-4: Write a Python Program to find the sum of a series of a given number
AIM: python program to find sum of series of given number.
Algorithm:
Step1: START
Step2: Input Get the value of num from the user
Step3: Initialize a variable total_sum to 0
Step4: Iterate from 1 to num(inclusive).In each iteration add the current number
to total_sum
Step5: Print total_sum
Step6: Stop
RGUKT R K Valley
P NABI RASOOL Information Technology
FlowChart
Python Programe:
RGUKT R K Valley
P NABI RASOOL Information Technology
Output:
Lab-5: Write a Python Program to Pattern printing using loops
AIM: python program to print pattern using loops.
Algorithm:
Step1: START
Step2: Get input prompt the user to enter the desired number of rows for the
pattern
Step3: Outer loop (Rows) iterate from 1 up to the number of rows (inclusive). This
loop handles moving to the next line for each row of the pattern.
Step4: Inner loop (columns/elements) inside the outer loop, iterate from 1 up to
the current row number (inclusive). This loop prints the desired element for the
current row.
Step5: Print element within the inner loop, print the desired element followed by
a space to separate elements on the same line. Use end=” “in the print ( )
function to prevent a newline after each element.
Step6: Newline after the inner loop completes use an empty print ( ) statement to
move the cursor to the next line for the subsequent row
Step7: STOP
RGUKT R K Valley
P NABI RASOOL Information Technology
FlowChart
RGUKT R K Valley
P NABI RASOOL Information Technology
Python Programe:
Output:
RGUKT R K Valley
P NABI RASOOL Information Technology
RGUKT R K Valley
P NABI RASOOL Information Technology
RGUKT R K Valley