PYTHON PROGRAMMING LAB
(Common to all branches)
R23MSCSL005
Total Contact Hours 42(L) L T P C
Pre-requisite - 0 0 3 2
Course Objective
Students will implement python programming constructs which are used to develop both
desktop and graphical user applications.
Course Outcomes
1 Students will be able to apply the basic building blocks of python language
like variables, operators and modules.
2 Students will be able to apply conditional control statements and functions.
3 Students will be able to apply various file operations and analyze the data
using pandas library.
4 Students will be able to choose and decide the suitable widgets to design and
develop Graphical User Interface (GUI) applications.
List of Experiments
1 Week – 1: DATA TYPES, OPERATORS, BUILT-IN FUNCTIONS
1. Write a python script to illustrate data types (int, char, float, string).
2. Write a python program to perform the following expressions using
operator precedence
(1) 5+3*2
(2) 2*32
(3) 232
(4) (23)2
3. Write a python program to illustrate type conversion functions
4. Write a python program to illustrate pi, sqrt, cos, sin functions of
mathmodule
2 Week – 2: PROGRAMS WITHOUT CONTROL STATEMENTS
1. Write a program to calculate simple interest
2. Write a python program to calculate compound interest
3. Write a python program to print ASCII value of a character
4. Write a python program to find the area of a circle
5. Write a python program to find the area of a triangle
6. Write a program to perform string concatenation
3 Week – 3: PROGRAMS ON NUMPY MODULE
1 Write a program to work with 1D array operations including indexing
and slicing.
2 Write a program to work with 2D array operations
4 Week – 4: PROGRAMS ON CONTROL STATEMENTS
1. Write a python program find the power of a number without built-in
functions.
2. Write a python program to count the number of even and odd
numbers upto the given range.
3. Write a python program to print the multiplication table for a given
number.
4. Write a python program to display minimum and maximum among
three numbers.
5 Week – 5: PROGRAMS ON FUNCTIONS
1. Write a python program to find if a number is prime or not with and
without recursion.
2. Write a python program to display Fibonacci series using iteration and
recursion.
3. Write a python program to find the factorial of a number w i t h
a n d without recursion.
6 Week – 6: PROGRAMS ON STRINGS
1. Write a program to work with string built-in functions
2. Write a python program to determine n u m b e r o f times a given
letteroccurs in a string
3. Write a python program to check if a string is a palindrome or not.
4. Illustrate in operator and write a python program to count number of
lowercase characters in a string.
5. Write a program to replace all the occurrences of letter ‘a’ with letter
‘x’ in a string.
7 Week – 7: PROGRAMS ON LISTS
1. Write a program to implement the following list functions a)len()
b)extend() c)sort() d) append() e)insert() f)remove()
2. Write a program to pass list as an argument to a function
3. Write a python program to find the largest and smallest number in a list.
4. Write a python program to merge two lists and sort it.
5. Write a python program to remove the duplicate items from a list.
6. Write a python program to find sum of elements in a list
8 Week – 8: PROGRAMS ON TUPLES , DICTIONARIES
1. Write a program to create a list of tuples with the first element as the
number and the second element as the square of the first element.
2. Write a python program that takes the list of tuples and sorts the list of
tuples in increasing order by the last element in each tuple.
3. Write a program to implement the following dictionary methods
a) keys() b) values() c)items() d) pop() e)delete()
4. Write a python program to add a key value pair to a dictionary and
update the dictionary based on the key.
5. Write a Program to do a reverse dictionary lookup in python.
9 Week – 9: PROGRAMS ON FILES
1. Write a program to implement read(), readline(), readlines(), write(),
writelines() methods on files.
2. Write a program to implement seek(), tell() and flush() methods with
different arguments in a file.
3. Write a program to generate 20 random numbers in the range of 1 to 100
and write to a file.
10 Week – 10: PROGRAMS ON PANDAS MODULE
1. Write a program to import data from CSV to DataFrame and inspect
data in DataFrame using head(), tail (), info() and describe() functions in
pandas.
2. Write a program to perform sorting and slicing operations in pandas.
3. Write a program to perform dataframe modification and data cleaning
in pandas.
11 Week – 11: PROGRAMS ON GUI
1. Design and develop a GUI application to display ―Hello World.
2. Design and develop a GUI application using Label, Entry and Button
widgets.
3. Design and develop a GUI application using Tkinter Geometry methods
pack(),grid(), place().
4. Design and develop a GUI application using CheckButton and
Radiobuttonwidgets.
12 Week – 12: PROGRAM ON GUI CONTI…
1. Design and develop a GUI application using Menu and Menubutton
widgets.
2. Design and develop a GUI application using Listbox and Scrollbar
widgets.
3. Design and develop a GUI application using Messagebox and File
Dialogwidget
Demonstration experiments
1 Demonstration of Python IDLE to implement solutions.
Demonstration on Colab notebook to read, access and display data from
2
google drive.
3 Demonstration on jupyter notebook to link and access data.
LEARNING RESOURCES
TEXTBOOKS:
Kenneth A. Lambert. ― Fundamentals of Python: First Programs‖, 2 nd
1
Edition,
Publisher: Cengage Learning
2 Reema Thareja.-Python Programming using Problem Solving Approach
3 R. Nageswara Rao, ―Core Python Programming‖
REFERENCE BOOKS:
1 Wesley J. Chun. ―Core Python Programming - Second Edition‖, Prentice Hall
2 John V Guttag. ―Introduction to Computation and Programming Using
Python‖, Prentice Hall of India.
3 Python Practice Book Release 2014, Anand Chitipothu.
ADDITIONAL REFERENCE MATERIAL
1 https://www.w3schools.com/python/
2 https://www.tutorialspoint.com/python/index.htm
3 https://docs.python.org/3/tutorial/
4 https://www.pythontutorial.net/tkinter
5 https://www.python-course.eu/python3_course.php
6 https://www.geeksforgeeks.org/python-tkinter-tutorial/
7 https://www.tutorialspoint.com/python/python_gui_programming.htm
8 https://www.programiz.com/python-programming