University of Engineering and Management
Institute of Engineering & Management, Salt Lake Campus
Institute of Engineering & Management, New Town Campus
University of Engineering & Management, Jaipur
Type of Course Course Code Course Name L T P Credit Points
Sessional OEC382 Python Programming Laboratory 1 0 2 2
Course Objective:
Through this sessional hands-on Python programming lab, the students will be introduced the
paradigm of Pyhton programming. They will learn basic concepts such as data handling, control
flow, and relevant command structure for procedural and object-oriented programming.
Additionally, these fundamental concepts of programming will lay the foundation for students and
enable them to design solutions for real problems in the field of AI and Data Science data analysis.
Course Outcomes: After completion of this course students would be able to
CO1: Understand fundamental components of programming in python
CO2: Implement solutions using object orient programming concepts using python classes and
objects
CO3: Develop databases, perform numerical computation and visualize data using python packages
CO4: Apply concepts of python to solve challenges in AI and Data Science.
Syllabus:
Module 1: Introduction to Python: The Python Interpreter, Console I/O, Conditions, Control Flow,
Functions,
Module 2: Python Data Handling: Datatypes, List, Tuple, Set, Dictionaries, File I/O
Module 3: Object Oriented Programming with Python: Classes, Objects, Special Methods:
init , call , iter , getitem , len
Module 4: Numerical Data Analysis with Python: NumPy N-D arrays, Indexing, Slicing, Reshaping,
ND-Array Arithmetic
Module 5: Database Handling with Python: Introduction to Pandas, Series, Dataframes, read CSV, read
JSON
Module 6: Data Visualization: Introduction to Matplotlib: Pyplot, markers, lines, labels, grid, subplot,
scatter, bars, histograms, pie-chart
Text Books:
(1) Head First Python: A Learner's Guide to the Fundamentals of Python
Programming, a Brain-Friendly Guide – (3rd edition, September 2023) - by Paul Barry (PUBLISHER:
O'Reilly book, Indian edition by SPD)
(2) Python for Data Analysis: Data Wrangling with pandas, NumPy, and Jupyter –
(3rd edition, September 2022) – by Wes McKinney (PUBLISHER: O'Reilly book, Indian edition by
SPD)
(3) Introduction to Computation and Programming Using Python, third edition:
With Application to Computational Modeling and Understanding Data Paperback –
(3rd edition, January 2021) – by John V. Guttag (PUBLISHER: The MIT Press)
Reference Books:
1) Python: The Complete Reference, Martin C. Brown, Osborne/McGraw-Hill
2) Python Crash Course, 3rd Edition: A Hands-On, Project-Based Introduction to Programming Paperback
– (3rd edition, January 2023) – by Eric Matthes
3) Python for Everybody: Exploring Data in Python 3 – (October 2017) – by Charles Severance (Shrroff
Publishers; First Edition (10 October 2017)
Alternate Courses:
NPTEL – Python for Data Science – Prof. Ragunathan Rengasamy, IIT Madras.
https://nptel.ac.in/courses/106106212
COURSERA – Python for Data Science, AI & Development, Joseph Santarcangelo -
https://www.coursera.org/learn/python-for-applied-data-science-ai
MIT MOOCS:
https://ocw.mit.edu/courses/6-0002-introduction-to-computational-thinking-and-data-science-fall-2016/
Laboratory/Practical: List of Experiments:
Mod Wk Ques Problem Statements
1 1 1a Write a program in python to calculate the area and perimeter of
various polygons such as triangle, rectangles and circles.
1b Write a program in python to input 3 numbers separated by comma,
and find the largest and smallest among them.
1c Write a program in python to find the roots of a quadratic equation
using python.
1d Write a program in python to print all prime numbers inside a range
of numbers provided by the user.
1e Write a program in python to print the mean and standard deviation of
5 scores input by the user.
2 2a Write a program in python to calculate the factorial of number
2b Write a program in python to calculate the Fibonacci sequence till a
specific no. of terms
2c Write a program in python to calculate the factors of number
2d Write a program in python to count the number of words in a string
2e Write a program in python to calculate the magic square based on a
given number
3 3a Print the series upto N terms: 1, 4, 9, 16, 25, 36…
3b Print the series upto N terms: 2, 4, 8, 16, 32, 64…
3c Print the series upto N terms: 1, 3, 7, 13, 21, 31 …
3d Print the series upto N terms: 1, 2, 4, 8, 16, 23, 28, 38, 49, 62 …
3e Print the series upto N terms: 1,2,6,24,120,720 …
4 4a Print the pattern upto N Lines:
. . .
/_\ / \ / \
/ \ / \
/ \
N=2 N=3 N=4
4b Print a number as a 8 segment display N Lines:
_ _
_| _| |_|
|_ _| |
N=2 N=3 N=4
4c Print the pattern upto N lines:
1 2 1 2 3 1 2 3 4
4 3 8 9 4 12 13 14 5
7 6 5 11 16 15 6
10 9 8 7
N=2 N=3 N=4
4d Print the following pattern upto N lines:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1 …
4e Print the shape for Height = N
*** **** *****
* * * * * *
*** * * * *
**** * *
*****
N=3 N=4 N=5
5 5a Input a number and check whether a given number is prime or not
using functions.
5b Input a number and check whether it is Armstrong or not using
functions.
5c Input a number and check whether it is Krishnamurthy or not using
functions.
5d Input a number and check whether the number is perfect or not using
functions.
5e Write program in python to display reverse of a number using
function.
2 6 6a Write a program to Insert and Delete elements from list based on a
given position
6b Find out Mean, Median and Mode of a list of numbers.
6c Sort a list of numbers without using a user defined function
6d Use a dictionary to count the frequency of words in a string input by
the user.
6e Given a list of numbers return the indices in which a specific number
occurs.
7 7a Write a program to create a text file as per the path and filename
provided by the user and add text as input by the user.
7b Write a program to copy the content of a text file to another file but
while copying convert all capital letters to small letters.
7c Create a text file to append N lines such that each line displays the
Fibonacci sequence upto the term corresponding to specific line
number separated by ‘-’. For N = 5 the text file should read.
1
1-1
1-1-2
1-1-2-3
1-1-2-3-5
7d Take input four values from user with respect to number of books,
pens, bags and total price as follows.
36,116,23,4649 and save it as a text file
Books: 36
Pens: 116
Bags : 23
Price : Rs. 4649
7e Write a program to create a dictionary by reading records from the
text file output in program 7d.
Dictionary : {“Books”:36, “Pens”: 116, “Bags”:23, “Price”: “4649”
7f Write a program to take inputs from user to create a dictionary for
storing and displaying student data.
7g Store the dictionary data as a CSV file and write a function to display
the data from the CSV file
7h Write a function to update or delete a specific record in student
database csv file.
3 8 8a Write a program to define a class “Box” and write functions to
calculate its volume
8b Write a program to define a class “Car” and necessary functions to
calculate the velocity given starting velocity (input), acceleration
(member variable) and time of acceleration(input).
8c Write a program to define a class “Student”, and record the name and
marks from a CSV file and display the grade card whenever the object
is called as a function using call ().
8d Write a program to define a class “Loan” with member variables as
principle, rate of interest and duration. Write a function to output the
maturity amount.
8e Create a class that will return the Fibonacci numbers sequentially
every time it is called using iter ()
8f Create a class “Data” that can store data points scattered in a 2-
dimensional space and belonging to three different categories. Write a
function to find the centroid of each category.
4 9 9a Write a program to take input and display the values of 2 dimensional
NumPy array
9b Write a program to add two 2-dimensional NumPy arrays
9c Write a program to transpose a 2-dimensional NumPy array
9d Write a program to reshape a 2-dimensional NumPy array.
9e Write a program to find the dot-product and matrix-product of two
NumPy arrays.
9f Write a program to find the inverse of a NumPy matrix
9g Write a program to calculate the Eigen value and Eigen vectors of
NumPy array
9h Write a program to find the determinant of NumPy matrix
9i Write a program using numpy to solve a system of linear equations
9j Write a program using numpy to perform singular value
decomposition of a matrix.
5 10 10a Read a CSV file as a pandas dataframe
10b Fetch rows from the dataframe based on a specific attribute
10c Display the value of specific columns of a pandas dataframe
10d Find the mean and standard deviation of a specific column containing
numeric data.
10e Save the dataframe as a JSON file
10f Use pandas and yfinance to read a stock market data as a series.
6 11 11a Write a program using matplotlib to display a line plot
11b Write a program using matplotlib to display a scatter plot
11c Write a program using matplotlib to display sine wave with frequency
and amplitude input by the user
11d Write a program to display bar-plot and histogram.
11e Display 4 plots as 2x2 grid using the subplot function
11f Write a program to plot the stock prices as computed in Ques. No.
10f.