ST.
ANDREWS INSTITUTE
OF TECHNOLOGY & MANAGEMENT
Gurgaon Delhi (NCR)
Approved by AICTE, Govt. of India, New Delhi affiliated to
Maharshi Dayanand University
‘A’ Grade State University, accredited by NAAC
Session: 2024 – 2025
Bachelor of Technology
Computer Science & Technology
A Practical File
Python Programming Lab
Subject Code-LC-CSE-215G
Submitted To: Submitted
by: NAME:
(Assistant Professor)
SEM:
ROLL
NO.:
St. Andrews Institute of Technology
& Management, Gurugram
Department
of…………………………… Practical
Lab Evaluation Sheet
Practic Viva Remarks
Attenda Practi Over
S. Program D C al - &
nce cal all
N at O Perfor V Signat
(05) File (25
o e med o ure
(05) )
(10) ce
(0
5)
1 Compute the GCD C
of two numbers. O
1
2 Find the square C
root of a number O
(Newton ‘s 1
method)
3 Exponentiation C
(power of a O
number) 4
4 Find the maximum C
of a list of numbers O
4
5 Linear search and C
Binary search O
2
6 Selection sort, C
Insertion sort O
2
7 Merge sort C
O
2
8 First n prime C
numbers O
4
9 Multiply matrices C
O
3
10 Programs that take C
command line O
arguments (word 4
count)
11 Find the most C
frequent words in O
a text read 1
from a file
12 Simulate elliptical C
orbits in Pygame O
3
13 Simulate bouncing C
ball using Pygame O
3
Average Marks
Approved & Verified by (Faculty Name) (Faculty Sign.)
⮚ Program 1: Compute the GCD of two numbers.
SOURCE CODE
import math
def compute_gcd(a, b):
gcd_value = math.gcd(a, b)
return gcd_value
# Example numbers
num1 = 60
num2 = 48
gcd_result = compute_gcd(num1, num2)
print(f"The GCD of {num1} and {num2} is: {gcd_result}")
OUTPUT
Program 2: Find the square root of a number Newton‘s method)
SOURCE CODE
OUTPUT
⮚ Program 3: Exponentiation (power of a number)
SOURCE CODE
OUTPUT
⮚ Program 4: Find the maximum of a list of numbers
SOURCE CODE
OUTPUT
⮚ Program 5: Linear search and Binary search
LINEAR SEARCH
SOURCE CODE
OUTPUT
BINARY SEARCH
SOURCE CODE
OUTPUT
⮚ Program 6: Selection sort, Insertion sort
SELECTION SORT
SOURCE CODE
OUTPUT
INSERTION SORT
SOURCE CODE
OUTPUT
⮚ Program 7: Merge sort
SOURCE CODE
OUTPUT
⮚ Program 8: First n prime numbers
SOURCE CODE
OUTPUT
⮚ Program 9: Multiply matrices
SOURCE CODE
OUTPUT
⮚ Program 10: Programs that take command line arguments (word
count)
SOURCE CODE
OUTPUT
⮚ Program 11: Find the most frequent words in a text read from a
file
SOURCE CODE
OUTPUT
⮚ Program 12: Simulate elliptical orbits in Pygame
SOURCE CODE
OUTPUT
⮚ Program 13: Simulate bouncing ball using Pygame
SOURCE CODE
OUTPUT