B.
Tech I Year–II Sem L T P C
Subject Code: 24ES2CS02 3 0 2 4
Python Programming
Course Objective:
1. Acquire programming skills in core Python.
2. Acquire Object-oriented programming skills in Python.
3. Develop the skill of designing graphical-user interfaces (GUI) in Python.
4. Develop the ability to handle files and exceptions in Python.
Course Outcomes:
1. Apply the concept of functions, class and objects to solve a given problem.
2. Perform operations on different types of sequences.
3. Develop GUI-based applications.
4. Explain the concept of exceptions, multithreading, files and regular
expressions.
Module -I
Python Basics, Objects- Python Objects, Standard Types, Other Built-in Types, Internal
Types, Standard Type Operators, Standard Type Built-in Functions, Categorizing the
Standard Types, Unsupported Types, Python installation.
Numbers - Introduction to Numbers, Integers, Floating Point Real Numbers, Complex
Numbers, Operators
Programming:
Week 1:
a) Read the temperature in centigrade and convert it into Fahrenheit.
b) Consider two numbers as input and swap those two values without using 3rd variable.
c) Read a list of numbers and write a program to check whether a particular element is
present or not using membership operators.
Week 2:
a) Read name, address, email and phone number of a person through keyboard and print the
details.
b) Read the year and check whether that year is a leap year.
c) Read 4 numbers and find maximum and minimum among those numbers
Module - II
Decision control Statements: Selection/Conditional branching statements, basic loop
structures/iterative Statements, nested loops, break, continue, and pass Statements.
Sequences - String, List, Tuple, Dictionary and Set.
Programming:
Week 3:
a) Write a program to check whether the given input is digit or lowercase character or
uppercase character or a special character (use 'if-else-if' ladder)
b) Write a Python program to print even numbers from 2000 to 2100 in a given interval (use
break).
Week 4:
a) Given a list of tuples. Write a program to find tuples which have all elements divisible
by K from a list of tuples. test_list = [(6, 24, 12), (60, 12, 6), (12, 18, 21)], K = 6,
Output : [(6, 24, 12), (60, 12, 6)]
b) Write a program to perform union, intersection and difference using Set A and Set B.
Module- III
Functions: Communicating with functions, Variable Scope and lifetime, return statement,
Types of arguments, modules, packages, Lambda functions.
Classes and Objects – Defining Classes, Creating Objects, Class variables and Object
variables, __init()__ and __del__() method.
Programming:
Week 5:
a) Write a function called is_sorted that takes a list as a parameter and returns True if the list
is sorted in ascending order and False otherwise.
b) Write a function called has_duplicates that takes a list and returns True if there is any
element that appears more than once. It should not modify the original list.
Week 6:
a. Write a recursive function to compute gcd, factorial, fibonacci series
b. Write a function to compute gcd, factorial, fibonacci series
Week 7:
a) Write a program to create an employee class and store the employee name, id, age, and
salary using the constructor. Display the employee details by invoking employee_info ()
method and also using dictionary(__dict__).
Module -IV
FILES: File Objects, File Built-in Function [open ()], File Built-in Methods, File Built-in Attributes,
Standard Files, Command-line Arguments.
Exception Handling: Introduction to Errors and Exceptions, Handling Exceptions, Multiple Except
Blocks, The Else Clause, Raising Exceptions, Handling the Exceptions in invoked functions, Built-in
and user-defined exceptions, The Finally Block, Re raising Exception, Assertions
Programming:
Week 8:
a) Write a python program that defines a matrix and prints
b) Write a python program to perform addition of two square matrices
c) Write a python program to perform multiplication of two square matrices
Week 9:
a) Write a Python Program to find the roots of a quadratic equation and handle the
appropriate exception.
b) Write a python program to check a given phone number is valid or not.
Module- V
Regular Expressions: Introduction, Special Symbols and Characters, Res and Python.
GUI Programming: Introduction, Tkinter Widgets and event handling.
Multithreaded Programming: Introduction, Threads and Processes, Python, Threads, and
the Global Interpreter Lock, Thread Module, Threading Module, Related Modules
Programming:
Week 10:
a) Write a Python program to create two threads where thread1 will print the value from 1-20
and thread2 prints from 21-40.
b) Write a Python program to multiply two n x n matrices using n threads.
Week 11:
a) Write a Python program to copy the content of given file to another a file.
b) Write a Python program to compute the number of characters, words and lines in a file.
TEXT BOOKS:
1. Reema Thareja, “Python Programming - Using Problem Solving Approach”, Oxford Press,
1st Edition, 2017.
2. Philips, “Python 3 Object Oriented Programming”, PACKT Publishing, 2nd Edition, 2015.
REFERENCE BOOKS:
1. Yashavant Kanetkar, Aditya Kanetkar, “Let Us Python”, BPB Publications, 2nd Edition,
2019.
2. Martin C. Brown, “Python: The Complete Reference”, McGraw Hill, Indian Edition, 2018.
3. Michael [Link], David Letscher, “Object Oriented Programming in Python”,
Prentice Hall, 1st Edition, 2007.
CO-PO/PSO Mapping:
CO-PO PO PO PO PO PO PO PO PO PO P P P PS PS PS
1 2 3 4 5 6 7 8 9 O O O O1 O2 O3
1 1 1
0 1 2
CO-1 3 2
CO-2 3
2
CO-3 3 2 3
2
CO-4
2 2