B.
Tech (CSE) R22
(A405506) PYTHON PROGRAMMING LABORATORY
(Common to all)
L T P C
B. Tech (CSE) III Semester 0 1 2 2
Week 1.
(Python Language Fundamentals-Installation -Identifiers, Reserved Words, Data Types, Type Casting,
Immutability)
Demonstration
Experiment-1: Install Anaconda open-source framework for python.
Experiment-2: Write a program to display ‘Hello World’.
Experimentation
Experiment-3: Explore various IDEs for python program development.
Experiment-4: The volume of a sphere with radius r is 4/3 πr3. Write a Python program to find the volume of a
sphere with
radius 5?
Week 2.
(Arithmetic Operators, Relational Operators, Logical operators, Bitwise operators, Assignment operators, Special
operators)
Demonstration
Experiment-1; Write a python program to find minimum and maximum of given three numbers.
Experiment-2: Suppose the cover price of a book is $24.95, but bookstores get a 40% discount.
Shipping costs $3 for the first copy and 75 cents for each additional copy. Write a python program to compute
the total wholesale cost for 60 copies.
Experimentation
Experiment-3: Write a Python Program to Find the Square Root of a number without using sqrt function.
Experiment-4: Python Program to Convert Celsius to Fahrenheit.
Experiment-5: Python program to find the maximum of two numbers using ternary operator
Week 3.
(Mathematical Functions, Input and Output statements, Command Line Arguments, String Functions)
Demonstration
Experiment-1: Write a Python program to find area of circle.
Experiment-2: Write a program to read Employee data from the keyboard and print that data.
Experimentation
Experiment-3: Write a program to read 3 float numbers from the keyboard with comma separator and print their
sum.
Experiment-4: Write a Program to display Command Line Arguments.
Week 4.
(Flow Control Statements-Conditional Statements, Transfer Statements, Iterative Statements)
Demonstration
Experiment-1. Write a Python program to take a single digit number from the keyboard and print is value in
English word.
Experiment-2. Write a Python Program to check whether an n-digit integer is an Armstrong number or not.
Experimentation
Experiment-3. Write a Python program to display *'s in pyramid style (also known as equivalent triangle).
Experiment-4. Write a Python Program to Display the multiplication Table.
Week 5.
(Functions-Built in functions, user defined functions, Parameters, return statement, returning multiple values from
function, type of arguments, Types of variables-global, local. Recursive functions, Lambda functions, filter function,
reduce function, Function aliasing, Function decorators, Generators)
CMR College of Engineering & Technology (UGC Autonomous) Page 76
B. Tech (CSE) R22
Demonstration
Experiment-1: Write a python function to find factorial of given number?
Experiment-2: Write a program to create a lambda function to find square of given number?
Experimentation
Experiment-3: Lambda Function to find biggest of given values.
Experiment-4: Program to filter only even numbers from the list by using filter() function?
Week 6.
(Working with Strings-Defining String, Multi-line Strings, accessing characters of a string, Mathematical operators
for strings, Membership operator, Comparison of Strings, removing spaces from the string, Finding Substring, String
replacement, Splitting of Strings, changing cases of a string, Formatting the strings)
Demonstration
Experiment-1: Write a program to accept some string from the keyboard and display its characters by index wise
(both positive and negative index).
Experiment-2: Write a program to access each character of string in forward and backward direction by using while
loop?
Experimentation
Experiment-3: Program to display all positions of substring in each main string.
Experiment-4: Write a program to reverse the given String.
Week 7.
(Python Data Structures-List: Creating a list- Accessing elements of a List, Traversing the List, List Manipulation,
Ordering the elements of a List, Mathematical Operators for List objects, Membership Operator, Nested Lists, List
Comprehensions)
Demonstration
Experiment-1: Write a Python program to display unique vowels present in the given word.
Experiment-2: Write a Python program to Count the Occurrence of an Item in a List.
Experimentation
Experiment-3: Write a Python program to segregate even and odd numbers from the given list of numbers.
Experimnet-4: Write a Python program to find the cumulative sum of elements of the list.
Week 8.
(Python Data Structures-Tuple: Creating a Tuple, Accessing the elements of a tuple, mathematical operators for
tuple,
Tuple packing and Unpacking)
Demonstration
Experiment-1: Python program for adding a Tuple to List and Vice-Versa.
Experiment-2: Write a Python program to perform the summation of all elements of each tuple from the list of
tuples.
Experimentation
Experiment-3: Write a Python program to multiply adjacent elements of a tuple.
Experiment-4: Write a Python program to find the maximum element in the tuple list.
Week 9.
(Python Data Structures-Set: Creating a Set object, functions of set, Mathematical operations on set, Membership
Operators, Set Comprehension, Python Data Structures-Dictionary: Creating a Dictionary Object, accessing data
from the dictionary, updating dictionaries, Deleting from dictionary, Functions on dictionary, dictionary
comprehension)
Demonstration
Experiment-1. Write a Python program to perform set operations.
Experiment-2: Write a program to print different vowels present in the given word?
Experiment-3: Write a Python program to generate powers of 2 using set comprehensions.
Experiment-4: Write a program to eliminate duplicates present in the list using set
Experiment-5: Write a Python program to enter name and percentage marks in a dictionary and display information
on the console.
CMR College of Engineering & Technology (UGC Autonomous) Page 77
B. Tech (CSE) R22
Experimentation
Experiment-6: Write a program to take dictionary from the keyboard and print the sum of values?
Experiment-7: Write a program to find number of occurrences of each letter present in the given string using
dictionary.
Experiment-8: Write a program to accept student name and marks from the keyboard and creates a dictionary. Also
display student marks by taking student name as input?
Week 10.
(Python Modules-Creating Modules, accessing members, module aliasing, member aliasing, reloading a module,
The special variable: __name___. Working with Math, random modules, Python Packages. Python-File Handling-
Types of Files, opening a file, closing a file, properties of File object, writing data to text file, reading character data
from text files, seek (), tell () functions.)
Demonstration
Experiment-1: Create a module fibo.py containing Fibonacci(n) function(s) and import fibo module in a python
script to print Fibonacci series up to n.
Experiment-2: Write a python program to print all the contents of a given module.
Experiment-3: Write a python program to create a package containing two or modules.
Experiment-4: Write a python program to import module from a package created in Experiment-3.
Experimentation
Experiment-5: Write a program to check whether the given file exists or not. If it is available then print its content?
Experiment-6: Write a python Program to print the number of lines, words and characters present in the
given file?
Experiment-7: Program to read image file and write to a new image file?
Experiment-8: Write a python program to read and write to a CSV file.
Note:
Experiments under the Demonstration section is to be demonstrated by the concerned faculty and the
experiments under Experimentation section must be performed by the students individually.
REFERENCE BOOKS
1.Allen B. Downey, “Think Python”, 2nd edition, SPD/O’Reilly, 2016.
2. Martin C.Brown, “The Complete Reference: Python”, McGraw-Hill, 2018.
3. Kenneth A. Lambert, B.L. Juneja, “Fundamentals of Python”, CENGAGE, 2015.
4. R. Nageswara Rao, “Core Python Programming”, 2nd edition, Dreamtech Press, 2019.
WEB LINKS:
1. https://docs.python.org/3/tutorial/modules.html#packages
2. https://www.includehelp.com/python/programs.aspx.
3. https://www.anaconda.com/products/individual
4. https://www.jetbrains.com/pycharm/
COURSE OUTCOMES:
On completion of the course students will be able to
1. Design solutions to computational problems using Python programming language constructs.
2. Write python programs to manipulate string objects.
3. Use appropriate Data structures to organize and manipulate data items.
4. Design modular application using python module & package concepts.
5. Develop application to read and write from various file formats.
CO-PO MAPPING:
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
CO1 1 1 3 2 2 - - - - - - 1
CO2 2 2 3 1 3 - - - - - - 1
CO3 3 2 2 1 3 - - - - - - 1
CO4 1 3 2 2 3 - - - - - - 1
CO5 - 2 1 1 3 - - - - - - 1
***END***
CMR College of Engineering & Technology (UGC Autonomous) Page 78