Python Course
Python Course
Python Course
Course Objectives:
1. To understand fundamental concepts in Python Programming
2. To learn the different Conditional Loops and Iteration
3. To understand various data structures and packages
Course Outcomes:
Contents:
Unit Content Teaching
Hours
1 Python for everybody: 6
Why Program, Hardware Overview, Python as a Language, Why Python,
Installation Python Jupyter notebook, Using the Python Playground ,how
to write program and compile in Jupyter notebook. Writing input and
output statements in Python, output formatting, Writing comments,
keywords in Python .variables and variable assignments, Operators
,writing expressions
2 Conditional Loops and Iteration: 6
Conditional Statements, in Python, Loops and Iteration, Definite Loops,
Finding the Largest Value, Loop Idioms
3 Data Structures in Python: 6
Strings, Manipulating Strings, Files, Processing Files, Dictionaries, sets,
Tuples, Lists, Manipulating Lists, Lists and Strings, Strings,
Manipulating Strings
4 Functions, Modules and Packages: 6
Functions, Lambda functions, Recursive function, Types of functions,
modules and packages.
5 Packages in Python for Data Science: 6
Numpy introduction, Numerical operations on Numpy, Introduction of
Matplotlib, getting started with Pandas, Data frames basics in Pandas, key
operations on data frames. Introduction to Data Science, Binary search,
finding elements in common in lists using Hash, Finding largest elements,
Introduction of SQL
Text Books:
1. Kent D. Lee, “Python Programming Fundamentals”, Second Edition, Springer Publication.
MGM Campus, N-6, CIDCO, Chhatrapati Sambhajinagar – 431003, Maharashtra, India. II mgmu.ac.in
27
General Instructions:
The theory classes are to be conducted batch wise in Lab. Each class should be divided
into four batches.
MGM Campus, N-6, CIDCO, Chhatrapati Sambhajinagar – 431003, Maharashtra, India. II mgmu.ac.in
35
Course Code: APS21ESP101 Course Name: Python Programming Lab Course Category:
Pre-requisites: Nil
Course Objectives:
The Objective of this course is
Course Outcomes:
LO1 : Demonstrate python program using development environment.
LO2: Develop logical thinking to solve the problems using programming fundamental concepts.
LO3 : Construct python program using various data structures.
LO4 : Apply modularization approach for solving complex problem.
LO5: Make use of various packages in Python for data science.
LO6 : Implement different SQL commands in python.
Contents:
Sr. List of Practical Lab
No. Hours
1 Program to perform input/output operations 02
Write a program to take input (integer, float, string) and print it.
2 Program based on operators 02
1.Write a program to simulate a simple calculator (+ - / * %) that takes two
operands as input and displays the result
2.Write a program to find area and perimeter of geometric objects.
3.The distance between two cities (in km.) is input through the keyboard.
Write a program to convert and print this distance in meters, feet, inches
and centimeters.
4. Write a Program to interchange two numbers.
5.Write a program to compute Fahrenheit from centigrade
3 Programs based on Decision making. 02
1.Write a program to read marks from keyboard and your program should
display equivalent grade according to following table(else-if ) (ladder)
Marks Grade
100 - 80 Distinction
79 - 60 First Class
59 - 40 Second Class
< 40 Fail
2.Write a program to input basic salary of an employee and calculate gross
salary according to given conditions.
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary is between 10001 to 20000 : HRA = 25%, DA = 90%
Basic Salary >= 20001 : HRA = 30%, DA = 95%
3.If the ages of three brothers are input through the keyboard, write a C
Program to determine the youngest and oldest of the three.
4.Write a program to calculate overtime pay of employee. Overtime is paid
at the rate of Rs. 12.00 per hour for every hour worked above 40 hours.
Assume that employee do not work for fractional part of an hour.
5.Write a program for checking the speed of drivers.
MGM Campus, N-6, CIDCO, Chhatrapati Sambhajinagar – 431003, Maharashtra, India. II mgmu.ac.in
36
If speed is less than 70, it should print “Ok”. Otherwise, for every 5km
above the speed limit (70), it should give the driver one demerit point and
print the total number of demerit points. For example, if the speed is 80, it
should print: “Points: 2”. If the driver gets more than 12 points, the
function should print: “License suspended”
4 Programs using while and for loops 02
1.WAP to find factorial of given number
2.WAP to check whether given number is Palindrome or not
3.WAP to check whether given number is Armstrong or not
4.WAP to print Fibonacci series
5.Write a Python program which iterates the integers from 1 to 50. For
multiples of three print "Fizz" instead of the number and for the
multiples of five print "Buzz". For numbers which are multiples of both
three and five print "FizzBuzz".
6.WAP to check whether given number is Perfect number or not
7.WAP to check whether given number is Prime number or not
8.Write C program to print given star and number patterns and reverse
it.
* 1
** 12
*** 123
**** 1234
5 Programs on string 02
1.Write Python Program to find length of string without using len()
function.
2.Count all letters, digits, and special symbols from a given string.
3.Python Program to Count the Number of Vowels in a String.
4.Python Program to Calculate the Number of Upper Case Letters and
Lower Case Letters in a String.
5.Python Program to Check whether given string is palindrome or not
6 Programs on List and Tuple 02
1.Write a Python program to sum all the items in a list.
2.Write a Python program to multiply all the items in a list
3.Write a Python program to get the largest number from a list.
4.Write a Python program to get the smallest number from a list
5.Write a Python program to count all elements in list and count
Occurrences Of A List Item In Python
6.Write a Python program to create a tuple with different data types
7. Write a Python program to check whether an element exists within a
tuple
8.Write a Python program to reverse a tuple
9. Write a Python program calculate the product of all the numbers
given in tuple. Original Tuple: (2, 4, 8, 8, 3, 2, 9)
Product - multiplying all the numbers of the said tuple: 27648
7 Programs on set and dictionary 02
1.Write a Python program to concatenate following dictionaries to
create a new one. Sample Dictionary : dic1={1:10, 2:20} dic2={3:30,
4:40} dic3={5:50,6:60}
Expected Result : {1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60}
2.Write a Python program to check whether a given key already exists
MGM Campus, N-6, CIDCO, Chhatrapati Sambhajinagar – 431003, Maharashtra, India. II mgmu.ac.in
37
in a dictionary
3.Write a Python script to generate and print a dictionary that contains a
number (between 1 and n) in the form (x, x*x)
Sample Dictionary ( n = 5) :
Expected Output : {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}
4.Write a Python program to merge two Python dictionaries
5.Write a Python program to get the maximum and minimum value in a
dictionary
6.Write a Python program to create set difference, Union and
intersection
7.Write a Python program to check if two given sets have no elements in
common
8 Programs using function 02
1. Write Functions to calculate your trip's costs:
2. Define a function called hotel_cost with one argument nights as
input
3. Define a function called plane_ride_cost that takes a string, city, as
input.
4. Define a function called rental_car_cost with an argument called
days.
5. Define a function called trip_cost that takes two arguments, city and
days. Like the example above, have your function return the sum of
calling the rental_car_cost(days), hotel_cost(days), and
plane_ride_cost(city) functions.
6. Write a program in to check a given number is even or odd using
the function.
7. Write a function Exchange to interchange the values of two
variables, say x and y. illustrate the use of this function in a calling
function.
8. Write a program to find Sum of natural number using recursion.
9. Write a program to print Fibonacci series number using recursion
9 Program using NumPy, Matplotlib and Pandas library 02
1.Write a program to perform matrix addition, substraction,
multiplication.
2.Plot all types of graph using Matplotlib.
3.Write a program which perform basic operation of Pandas.
10 Program on SQL Commands 02
1. Write a program of binary search
2. Write a program which perform basic SQL commands
3. Programs based on real life problems/GUI based programs
MGM Campus, N-6, CIDCO, Chhatrapati Sambhajinagar – 431003, Maharashtra, India. II mgmu.ac.in