Python Programming Lab ( SET 1)
Paper Code : MCA- 166
1. Write a program to find
a. Sum of Digits of a number
b. Product of digits
2. Write a program for
a. Multiplication
b. Factorial
3. Write a program:
a. To find numbers divisible by 7 and are not multiple of 5. In range of 2000-3200
inclusive.
b. Which will have a list of values and then input a number to check if the value
exist in the list or not.
4. Write a program to:
a. Input 5 numbers in the list and print in ascending order.
b. Insert a value in the list at particular position.
c. Count elements in the list until the occurrence of the first tuple. In the list.
5. Write a program to:
a. Replace an empty tuple with another tuple or list.
b. Replace last element of a tuple.
6. Wap to:
a. implement Linear search on list and tuple.
b. print Fibonacci series.
7. Wap to create a function that accepts abbreviations of states as args and returns the
full name of the states ,return null if no mapping is found.
8. Write a function:
a. To print all powers of 2 in the range 1-12 (inclusive).i.e including 12.
b. That accepts lowercase words and returns uppercase.
9. Write a program to create a function show_employee() using the conditions:
i. It should accept the employee’s name and salary and display both.
ii. If the salary is missing in the function call then assign default value
50000 to salary
10. Write a program:
a. That accepts a hyphen-separated sequence of words as input and prints the
words in a hyphen-separated sequence after sorting them alphabetically.
b. To add some days to your present date and print the date added.
11. Write a Python function that takes two lists and returns True if they are equal otherwise
false
12. Wap to print the following patterns
a. * * * * *
*****
*****
*****
*****
b. 1 1 1 1 1
22222
33333
44444
55555
c. 1 2 3 4 5 6 7
1234567
1234567
1234567
1234567
1234567
1234567
d. A A A A A A A
BBBBBBB
CCCCCCC
DDDDDDD
EEEEEEE
FFFFFFF
GGGGGGG
e. *
**
***
****
*****
f. *
**
***
****
*****
g.
*
***
*****
*******
*********
h.
*********
*******
*****
***
*
i.
1111 1
2222
333
44
5
13. Write a Python program to reverse a string using function .
Sample String : "1234abcd"
Expected Output : "dcba4321
14. Program to:
a. compute gcd of two numbers recursively in Python.
b. to find factorial of a number using Recursion.
15. Python program to:
a. convert decimal into other number systems
b. Make a Simple Calculator using functions.
16. '''Write a program that accepts the lengths of three sides of a triangle as inputs. The
program output should indicate whether or not the triangle is a right triangle (Recall
from the Pythagorean Theorem that in a right triangle, the square of one side equals
the sum of the squares of the other two sides).'''
17. Write a python program to define a module to find Fibonacci Numbers and import the
module to another program.
18. Write a program:
a. using decorator to perform division.
b. Iterator
c. Generator.
19. Write a python program to define a module and import a specific function in that module to
another program.
20. Write a program in Python to implement readline, readlines, writeline and writelines
using
file handling mechanisms.
21 Perform following operations on a CSV file
a. Create a data frame from csv file, dictionary, List of tuples
b. Operations on Data Frame Shape, head, tail
c. Retrieving rows / columns from data frame
d. Finding maximum and minimum values
e. Performing queries
f. Data Analysis using groupby()
22.