0% found this document useful (0 votes)
4 views3 pages

Python program list

The document outlines a comprehensive set of programming exercises in Python, categorized into various topics including data types, conditional statements, loops, strings, lists, tuples, dictionaries, functions, recursion, object-oriented programming, exception handling, regular expressions, and file handling. Each category contains multiple tasks aimed at demonstrating specific programming concepts and techniques. The exercises range from basic operations to more advanced programming challenges.

Uploaded by

Garvit Pareta
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
4 views3 pages

Python program list

The document outlines a comprehensive set of programming exercises in Python, categorized into various topics including data types, conditional statements, loops, strings, lists, tuples, dictionaries, functions, recursion, object-oriented programming, exception handling, regular expressions, and file handling. Each category contains multiple tasks aimed at demonstrating specific programming concepts and techniques. The exercises range from basic operations to more advanced programming challenges.

Uploaded by

Garvit Pareta
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 3

Programming in Python Lab

A 1. Write a program to demonstrate different number data types in Python.


Basic 2. Write a program to perform different Arithmetic Operations on numbers in Python.
3. Program to create random number generator which generate random number between
1 and 6
4. Program to swap two number and display number before swapping and after swapping
5. Write a program in python, that calculates the volume of a sphere with radius r entered
by the user. (Assume π = 3.14)
B 1. Write a program to check whether an entered year is leap or not.
Conditional 2. Write a program to find largest among 3 numbers.
Statements 3. Write a Program to check if the entered number is Armstrong or not.
4. Write a program that reads roll no. from a student. Then your program should display a
message indicating whether the number is even or odd.
5. Let us say a teacher decided to give grades to her students as follows:
a) Mark greater than or equal to 80: Excellent
b) Mark greater than or equal to 65 but less than 80: Good
c) Mark greater than or equal to 50 but less than 65: Pass
d) Mark less than 50: Fail
Write a program in python to print a grade according to a student's mark with multiple if
statements
C 1. Write a python program to find factorial of a number
Loops 2. Write a python program that prints prime numbers less than 20.
3. Write a Program to print multiplication table of any number
4. Write a Program to check whether a number is palindrome or not
5. Write a Program to construct the following pattern using nested for loop:
*
**
***
****
*****
*****
****
***
**
*
6. Write a Program to print Fibonacci series up to n terms using loop statement
D 1. Write a program to create, concatenate and print a string and accessing sub-string from
String a given string.
2. Write a program find length of a string.
3. Write a Program to check whether a string is palindrome or not.
4. Write a Program to count all letters, digits, and special symbols from a given string.
5. Write a Program to calculate the sum and average of the digits present in your
registration number.
E 1. Write a program to demonstrate various list operations in python.
Lists 2. Write a program to find even numbers from a list
3. Write a program to interchange first and last element of a list
4. Write a program to turn every item of a list into its square
5. Write a program to check all elements are unique or not in Python
6. Write a program to replace list’s item with new value if found
7. Write a program to find the position of minimum and maximum elements of a list.
8. Write a program to find the cumulative sum of elements of a list
9. Write a program that reads integers from the user and stores them in a list. Your program
should continue reading values until the user enters 0. Then it should display all of the
values entered by the user (except for the 0) in order from smallest to largest, with one
value appearing on each line.
10. Write a program that reads integers from the user and stores them in a list. Use 0 as a
sentinel value to mark the end of the input. Once all of the values have been read your
program should display them (except for the 0) in reverse order.
F 1. Write a program to demonstrate various tuple operations in python.
Tuples 2. Write a program to find the size of a tuple
3. Write a program to find the maximum and minimum K elements in a tuple
4. Write a program to create a list of tuples from given list having number and its cube in
each tuple
G 1. Write a program to demonstrate working with dictionaries in python
Dictionary 2. Write a Program to create a dictionary from a sequence
3. Write a Program to generate dictionary of numbers and their squares (i, i*i) from 1 to N
4. Write a Program that determines and displays the number of unique characters in a string
entered by the user. For example, “Hello, World!” has 10 unique characters while “zzz”
has only one unique character. Use a dictionary to solve this problem.
5. Two words are anagrams if they contain all of the same letters, but in a different order.
For example, “evil” and “live” are anagrams because each contains one ‘e’, one ‘I’, one
‘l’, and one ‘v’. Create a program that reads two strings from the user, determines
whether or not they are anagrams, and reports the result.
H 1. Write a Program to write user defined function to swap two number and display number
Functions before swapping and after swapping
2. Write a Program to calculate arithmetic operation on two number using user defined
function
3. Write a Program to Calculate diameter and area of circle using user defined function
4. Write a function that takes three numbers as parameters, and returns the median value
of those parameters as its result. Include a main program that reads three values from
the user and displays their median.
5. Write a function that generates a random password. The password should have a random
length of between 7 and 10 characters. Each character should be randomly selected from
positions 33 to 126 in the ASCII table. Your function will not take any parameters. It will
return the randomly generated password as its only result.
6. Write a Program to filter even values from list using lambda function
7. Write a Program to find the sum of elements of a list using lambda function
8. Write a Program to find small number between two numbers using Lambda function
I 1. Write a python program to find factorial of a number using Recursion.
Recursion 2. Write a Program to print Fibonacci series up to n terms using recursion
3. Write a program that reads values from the user until a blank line is entered. Display the
total of all of the values entered by the user (or 0.0 if the first value entered is a blank
line). Complete this task using recursion. Your program may not use any loops.
J 1. Write a Program to implement destructor and constructors using __del__() and
OOP __init__()
2. Write a Program to implement Getters and Setters in a class
3. Write a Program to calculate student grade using class
4. Write a Program to illustrate single inheritance in Python
5. Write a Program to illustrate multiple inheritance in Python
6. Write a Program to illustrate multilevel inheritance in Python
K 1. Write a Program to illustrate handling of divide by zero exception
Exception 2. Write a Program to illustrate handling of IndexError Exception
Handling 3. Write a Program to illustrate handling of ValueError Exception
4. Write a Program to illustrate handling of Type exception
L 1. Write a Program to match a string that contains only upper and lowercase letters,
Regular numbers, and underscores
Expression 2. Write a Program that matches a string that has an a followed by zero or more b's
3. Write a Program that matches a string that has an a followed by one or more b's
4. Write a Program that matches a string that has an a followed by three 'b'
5. Write a Program to find the sequences of one upper case letter followed by lower case
letters
6. Write a Program that matches a word at the beginning of a string
7. Write a Program to search some literals strings in a string.
8. Write a Program to replace whitespaces with an underscore and vice versa.
9. Write a Program to remove all whitespaces from a string.
10. Write a Program to validate a 10-digit mobile number
M 1. Write a Program to count number of words in a file
File 2. Write a Program to find out longest word from a file
Handling 3. Write a Program to count total number of uppercase and lowercase characters in file
4. Write a Program to read all the contents of CSV file and display only specific columns
5. Write a Program to write python list to CSV file and display the contents

You might also like