0% found this document useful (0 votes)
6 views

Python Practicals

The document outlines 16 Python programs covering common tasks like checking for leap years, generating patterns, calculating factorials and Fibonacci sequences, checking for palindromes, sorting lists with different algorithms, and implementing common data structures like stacks and queues. The programs are intended as practical exercises to help learn Python fundamentals. For each program, the aim, required code, and example output are listed.

Uploaded by

shabansheikh75
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Python Practicals

The document outlines 16 Python programs covering common tasks like checking for leap years, generating patterns, calculating factorials and Fibonacci sequences, checking for palindromes, sorting lists with different algorithms, and implementing common data structures like stacks and queues. The programs are intended as practical exercises to help learn Python fundamentals. For each program, the aim, required code, and example output are listed.

Uploaded by

shabansheikh75
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 33

Python Practical’s

Program 1
Aim; -
Write a program that reads an integer value and prints leap year or not a leap year.
Code; -

Output: -
Program 2
Aim: -
Write a program that takes a positive integer a and then produces n line of output shown as
follows:
Coding: -
Output: -
Program 3
Aim: -
Write a program to create the following pattern
For example, Enter a size: 5
*
**
***
****
*****
Coding: -
Output: -
Program 4
Aim: -
Write a function that takes an integer n as input and calculate the value of 1+1/1! + 1/2! +
1/n!
Coding: -
Output: -
Program 5
Aim: -
Write a function that takes an integer input and calculates the factorial of that number.
Coding: -
Output: -
Program 6
Aim: -
Write a function that takes a string input and checks if it is a palindrome or not.
Coding: -

Output: -
Program 7
Aim: -
Write a list function to convert a string into a list, as in list (-abc) gives [a,b,c].
Coding: -

Output: -
Program 8
Aim: -
Write a program to generate Fibonacci series.
Coding: -

Output: -
Program 9
Aim: -
Write a program to check whether the input number is even or odd.
Coding: -

Output: -
Program 10
Aim: -
Write a program to compare three numbers and print the largest one.
Coding: -

Output: -
Program 11
Aim: -
Write a program to print factors of a given number.
Coding: -

Output: -
Project 12
Aim: -
Write a method to calculate GCD of two numbers.
Coding: -

Output: -
Program 13
Aim: -
Write a program to create Queue class and implement all its methods (use lists).
Coding: -
Output: -
Program 14
Aim: -
Write a program to create Stack class and implement all its methods (use lists).
Coding: -
Output: -
Program 15
Aim: -
Write a program to implement linear and binary search on lists.
Coding: -
Output:-

Output:-

Program 16
Aim: -
Write a program to sort a list using insertion sort, bubble sort and selection sort.
Coding: -
Output: -

Output: -
Output: -

You might also like