0% found this document useful (0 votes)
14 views6 pages

Python Programming Assignment Overview

The document is a Python programming assignment by student Hassan Irfan from SIDDEEQ Public School and College. It includes various sections on basic programs, loop-based programs, sorting algorithms, and searching algorithms, with examples and outputs for each. Key examples include finding the largest and smallest numbers, calculating the sum of a list, and implementing bubble sort and search algorithms.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

Python Programming Assignment Overview

The document is a Python programming assignment by student Hassan Irfan from SIDDEEQ Public School and College. It includes various sections on basic programs, loop-based programs, sorting algorithms, and searching algorithms, with examples and outputs for each. Key examples include finding the largest and smallest numbers, calculating the sum of a list, and implementing bubble sort and search algorithms.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SIDDEEQ PUBLIC SCHOOL AND COLLEGE

PYTHON PROGRAMMING ASSIGNMENT

Student Name: Hassan Irfan


Class: ICS-II
Roll No: B-7546

Teachers: Sir Zeeshan & Sir Junaid


Table of Contents

1 Basic Programs
2 Loop-Based Programs
3 Sorting Algorithms
4 Searching Algorithms
Basic Programs

Largest and Smallest Number


numbers=[12,5,7,25,3,19]
print(max(numbers), min(numbers))
Output: Largest=25, Smallest=3

Sum of List
numbers=[4,6,8,10]
print(sum(numbers))
Output: 28
Loop-Based Programs

Even/Odd
for n in range(1,21):
print(n)
Output: Even/Odd lists generated

Factorial
num=5
fact=1
for i in range(1,num+1): fact*=i
Output: 120
Sorting Algorithms

Bubble Sort Asc


arr=[5,2,9,1]
...
Output: [1,2,5,9]

Bubble Sort Desc


arr=[5,2,9,1]
...
Output: [9,5,2,1]
Searching Algorithms

Linear Search
arr=[4,7,1,9]
...
Output: Found at index 3

Binary Search
arr=[1,3,5,7]
...
Output: Found at index 3

You might also like