0% found this document useful (0 votes)
0 views

CHO_Python

The document outlines the course details for 'Python Programming' offered by the School of Computing, including course code, credits, and instructor information. It provides a comprehensive course description, expected outcomes, and a detailed syllabus covering various modules such as control structures, object-oriented programming, and file handling. Additionally, it includes experiential learning projects, resources, and pedagogical methods for effective course delivery.

Uploaded by

P.K. Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

CHO_Python

The document outlines the course details for 'Python Programming' offered by the School of Computing, including course code, credits, and instructor information. It provides a comprehensive course description, expected outcomes, and a detailed syllabus covering various modules such as control structures, object-oriented programming, and file handling. Additionally, it includes experiential learning projects, resources, and pedagogical methods for effective course delivery.

Uploaded by

P.K. Gupta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

COURSE HAND OUT

School: School of Computing Dept.: Cyber Security

Course Code : 22CS102002

Course Title : PYTHON PROGRAMMING

Course Credit L T P S C
Structure 3 - 2 - 4
Year
&Semester
Contact Hours : 45Hours
Instructor : SREETHARAN.V
Instructor’s : [email protected]
Email
Office Hours : All working days
Academic Year : 2024-25
Date of Issue : 12-07-2024
Pre-Requisite Python Programming
Anti-Requisite -
Co-Requisite -

COURSE DESCRIPTION: Python courses are distinguished by their affordability,


friendliness, and openness to the student. They all start from the absolute basics, guiding
you step by step to complex problems, making you a competent and responsible software
creator able to undertake different challenges in many positions in the IT industry.

COURSEOUTCOMES: After successful completion of the course, students will be able to:

CO1. Demonstrate knowledge on Python constructs, sequences, sets and dictionaries to


solve basic computational problems.
CO2. Apply the concepts of regular expressions for searching patterns in strings

CO3. Develop and use Python modules to provide solutions to problems.

CO4. Apply the knowledge of file operations in Python for file processing.

CO5. Design applications using object-oriented programming features – encapsulation,


inheritance, polymorphism and exception handling.

CO6. Work independently to solve problems with effective communication.


CO-PO-PSO Mappin Table:

Program Specific
Program Outcomes
Learning Outcomes
Outcomes
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2 PSO3 PSO4

CO1 3 2 - - 3 - - - - - - - 3 - - -
CO2 3 2 - - - - - - - - - - 3 - - -
CO3 3 3 3 3 3 - - - - - - - 3 - - -
CO4 3 2 2 2 2 - - - - - - - 3 - - -
CO5 3 3 3 3 3 - - - - - - - 3 - - -
CO6 - - - - - - - - 3 3 - - - - - -
Course
Correlation 3 3 3 3 3 - - - 3 3 - - 3 - - -
Mapping

CorrelationLevels: 3:High; 2:Medium; 1:Low


COURSECONTENT

Module1: INTRODUCTION TO PYTHON PROGRAMMING (07 Periods)

Introduction to Python, Tokens, Variables, Literals, Identifiers, Keywords, Special symbols,


Operators, Fundamental datatypes, Expressions, Type conversions, Handling Input and output in
Python

Module 2: CONTROL STRUCTURES (08 Periods)

Selection Statements: if statement, if-else statement, else-if statement, nested-if statement.

Iterative Statements: while loop, for loop, break statement, continue statement, pass, and else
statements used with loops.

Module3 SEQUENCES, SETS, DICTIONARIES AND REGULAR (11 Periods)


EXPRESSIONS

Sequences: Lists and operations – Creating, Inserting elements, Updating elements, Deleting
elements, Searching and sorting, List comprehensions, Nested lists; Tuples – Creating, Searching
and sorting, Nested tuples; Strings – Initializing a string and string operations, String handling
methods, String formatting.

Sets: Set creation, Set operations.

Dictionaries: Operations on dictionaries, Dictionary methods, Sorting elements using lambdas.

Regular Expressions: Regular expressions, Sequence characters in regular expressions,


Quantifiers in regular expressions, Special characters in regular expressions.

Module4 FUNCTIONS AND FILE HANDLING (09 Periods)

Functions: Need for functions, Function definition, Function call, Variable scope and lifetime, Return
statement, Positional arguments, Keyword arguments, Default arguments and variable length
arguments, Recursive functions, Lambda functions, Generators.

File Handling: Types of files, Opening and closing files, Reading and writing data

Module5 OBJECT ORIENTED PROGRAMMING AND EXCEPTION (10 Periods)


HANDLING

Object Oriented Programming: Introduction to object-oriented programming, Classes and


objects, Inheritance and polymorphism, Abstract Classes and interfaces.

Exception Handling: Errors in a python program, Exceptions, Exception handling, Types of


exceptions, Except block, Assert statement, User defined exceptions.

TotalPeriods:45
EXPERIENTIAL LEARNING

1 Design a python script to the perform the various computations for the amount payable by the
customer for Challenger Computers Store. A customer buying two numbers of SSD device, one
SSD device cost is Rs. 3575/-. The stores offer 15% of the total cost. The customer has to pay
9% CGST, and 9% SGST. Prepare the Net Amount to be payable by the customer.

2 Design a python script to compute and generate the electricity bill as per the following slab
rates. Collect the meter reading inputs, such as current unit and previous unit.

Consumption Units Rate (in Rupees/Unit)

0-200 3.0

201-250 4.5

251-300 5.2

301-400 6.5

Above 400 7.0

3 Design a python script to display the sum of numbers divisible by 4. The code must allow the
user to accept a number and add it to the sum if it is divisible by 4. It should repeatedly
accepting numbers as long as the user wants to provide an input using an appropriate iterative
statement and should display the final sum.

4. Food Corner home delivers vegetarian and non-vegetarian combos to its customer based on
order. A vegetarian combo costs Rs.120 per plate and a non-vegetarian combo costs Rs.150
per plate. Their non-veg combo is really famous that they get more orders for their non-
vegetarian combo than the vegetarian combo. Apart from the cost per plate of food, customers
are also charged for home delivery based on the distance in kms from the restaurant to the
delivery point. The delivery charges are as mentioned below:

Distance in kms Delivery charge in Rs per km

For first 3kms 0

For next 3kms 3

For the remaining 6

Given the type of food, quantity (no. of plates) and the distance in kms from the restaurant to
the delivery point, write a python program to calculate the final bill amount to be paid by a
customer. The below information must be used to check the validity of the data provided by the
customer.

 Type of food must be ‘V’ for vegetarian and ‘N’ for non-vegetarian.

 Distance in kms must be greater than 0.

 Quantity ordered should be minimum 1.

 If any of the input is invalid, bill amount should be considered as -1.


5 a) A list has the AP City Names [Tirupati, Kurnool, Kadapa]. Design a python script and
perform the operations like, add 3 more AP City names Chittoor, Nellore, Guntur, insert
Hyderabad in 3rd position, delete any two city names, update all city names as in
Uppercase. Displays the list data, whenever an operation completes.

b) Design a python script for given an integer tuple, for each element in the tuple, check
whether there exists a smaller element on the next immediate position of the tuple. If it
exists print the smaller element. If there is no smaller element on the immediate next to
the element then print -1.

Example: Input: 4 2 1 5 3 Output: 2 1 -1 3 -1

6 a) Sets n1 has the data {1, 3, 5, 7, 9}, n2 has the data {9, 5, 6, 8}, wd1=set(["Mon", "Tue",
"Wed", "Thu", "Fri", "Sat", "Sun"]), wd2=set(["Mon", "Tue", "Wed"]). Design a python
script to perform intersection, difference, and symmetric difference operations on the sets
n1 and n2, and to perform superset, and subset operations on the sets wd1, and wd2.

b) The dictionary city_pin has the data {'Tirupati': 517101, 'Hyderabad': 500002, 'Chittoor':
517001,'Nellore': 524001}. Design a python script using lambda function to sort the
dictionary on city name and produce the output and sort the dictionary on pincode and
produce the output.

c) The string has the data, Wel_str = "Welcome to AI ML DS". Design a python script to
search the pattern “AI” using regular expression search and display the three location
numbers of the pattern. First shows the pattern starts location, second shows the pattern
end location, and the last shows pattern span locations.

7 a) Design a python script for the mathematical puzzle, Towers of Hanoi. The puzzle has three
rods and n disks. To move the entire stack to another rod, obeying the three rules (i) Only
one disk can be moved at a time, (ii) Each move consists of taking the upper disk from one
of the stacks and placing it on top of another stack i.e., a disk can only be moved if it is the
uppermost disk on a stack, (iii) No disk may be placed on top of a smaller disk.

b) Design a python script to display the numbers that do not appear in the Fibonacci series of
n numbers where n is given by the user. (If n is 8 then up to 8 Fibonacci numbers has to be
printed Ex: 1 1 2 3 5 8 13 21 and in this series missing numbers should be traced and
printed, Ex: missing numbers are: 4 6 7 9 10 11 12 14 15 16 17 18 19.

8 Design a function Learner_Age_Days with two formal parameters name, age and it computes
Learner’s age in days, then displays learners name and age in days.

(i) Design a driver code to call the function using positional arguments, keyword
arguments

(ii) Apply the necessary changes in Learner_Age_Days function, and design a driver
code to call the function using default arguments.

a) Design a python script using lambda and filter functions to construct an odd numbers list
from numbers 1 to 10, and construct a negative numbers list from range of numbers -7 to
7 and to find the biggest number from a numbers list.

9 a) Design a python script to create a new file Collect_Literals_Phython.txt, collect the data
from the keyboard about the contents of collection literals list, tuple, sets, dictionaries
details, then write all the data into that file, and then close that file. Afterwards Open the
Collect_Literals_Phython.txt file in read mode, read the entire contents of the file
Collect_Literals_Phython.txt, then display all the contents of that file in monitor.

b) The file feat_python1.txt has the contents of features of the Python programming
language. Design a python script to open that file feat_python1.txt in read mode, open
the new file in feat_python2.txt in write mode, then read entire contents of the file
feat_python1.txt, then copy all the contents of that file into the new file feat_python2.txt

10 a) Construct a Python script to implement the below requirements. Create a base class
Basic_Info with data members name, rollno, gender and two member functions
getdata() and display(). Derive a class Physical_Fit from Basic_Info which has data
members height and weight and member functions getdata() and display(). Display all
the information using object of derived class.

b) Design a Python script to implement the below specifications, compute, and produce
required output. Define a class REPORT with the following specification

Private members

Admin no: 4-digit admission number

Name: 20 characters

Marks: A list of 5 floating point values

Average: average marks obtained

GETAVG () a function to compute the average obtained in five subjects.

Public members

READINFO () function to accept values for Admin no, Name, Marks. Invoke the function
GETAVG (). DISPLAYINFO () function to display all data members of a report on the screen.
You should give function definitions. Write driver code to demonstrate all the functions.

11 a) The below scenarios will create a Logical Error/Exception, and it will forcibly stop the
execution in the middle of the program. Design a Python Script to handle these

i. operations exceptions effectively, and avoid stopping the script execution in the
middle. The variable num has the data 100, the value of num divided by the
value 0.

ii. To import a library file, Matheny, this library file is not available in Python.

iii. A num_List has the values[10,20,30].To print the fifth value of num_List[5]

iv. .A dictionary has the data, Dict_Univ = {'1': "MBU", '2': "Tirupathi", '3':"CSE"}.
to print the fifth key value Dict_Univ[5]

b) Design a Python script to collect the 10 students' Python course marks. Check that the
entered mark is negative, then throw a user-defined exception called Negative,
otherwise, store it into the mark in the List Python mark[].
RESOURCES

TEXT BOOKS:
1. R. Nageswara Rao, Core Python Programming, 3rd Edition, Dream tech Press, 2021. 2.

2. Paul J. Deitel, Harvey Deitel, Python for Programmers with Big Data and Artificial Intelligence
Case Studies, Pearson, 2019.

REFERENCE BOOKS:
1. Charles Dieback, Introduction to Computer Science using Python: A Computational Problem-
Solving Focus, Wiley India, 2016.

2. Christian Hil, Learning Scientific Programming with Python, 2nd Edition, Cambridge
University Press, 2020.

SOFTWARE/TOOLS:
1. Python 3.10

2. Jupyter Notebook/Jupyter Lab/IDLE/Google CoLab

VIDEO LECTURES:
1. https://onlinecourses.nptel.ac.in/noc19_cs41/preview
2. https://www.coursera.org/specializations/python
3. https://www.coursera.org/learn/python-for-applied-data-science-ai
4. https://freevideolectures.com/course/2512/python-programming
5. https://www.youtube.com/watch?v=_uQrJ0TkZlc
6. https://www.udemy.com/topic/python/ 7.
7. https://www.youtube.com/watch?v=WGJJIrtnfpk

WEB RESOURCES:
1. https://www.w3schools.com/python/ 2.
2. https://www.programiz.com/python-programming
3. https://www.geeksforgeeks.org/python-programming-language/
4. https://www.javatpoint.com/python-lists
5. https://www.learnpython.org/

PEDAGOGY:
The following pedagogy methods will be used to deliver the course.
A) checkerboard
B) practical’s
C) PPT
D) Flipped Classroom
E) Experiential Learning/participatory learning
COURSE DELIVERY SCHEDULE:

S. Contact CO
No Topic Mapping Pedagogy Resources
Hours
Overview of the Course

Module1: INTRODUCTION TO PYTHON PROGRAMMING


CO1 PPT Presentation &
TB1,RB1,
1. Introduction to Python 01 Program
demonstration VL1,WR1
CO1 PPT Presentation &
TB1,RB1,
2. Tokens, Variables, Literals, 01 Program
demonstration VL1,WR1
Identifiers, Keywords, Special
symbols
CO1 PPT Presentation &
TB1,RB1,
3. Operators 01 Program
Demonstration VL1,WR1
CO1 PPT Presentation &
Fundamental datatypes, TB1,RB1,
4. 01 Program
Demonstration VL1,WR1
CO1 PPT Presentation &
TB1,VL1,
5. Expressions, 01 Program
WR1
Demonstration
CO1 PPT Presentation &
TB1,VL1,
6. Type conversions, 01 Program
WR1
demonstration
TB1,VL1,
7. Handling Input and output in Python 01 CO1 Demonstration WR1

Module-2 CONTROL STRUCTURES

Selection Statements: CO2 PPT Presentation &


10. 01 Program TB1,RB1,
if statement demonstration; VL1,WR2
Case study

CO2 Demonstration &


practical’s Case TB1,RB1,
11. if-else statement, 01
study VL1,WR2
if-elif-else statement, Demonstration; TB1,RB1,
12. 01 CO2
Case study VL1,WR2
CO2 PPT Presentation &
TB1,RB1,
13. nested-if statement. 01 Program
VL1,WR2
demonstration
CO2 PPT Presentation &
14. 01 Program TB2,VL2
Iterative Statements: while loop demonstration;
Case study
CO2 PPT Presentation &
15. 01 Program TB2,VL2
for loop,
demonstration;
Case study
CO2 PPT Presentation &
16. break statement, continue 01 Program TB2,VL2
statement, demonstration;
Flipped classroom
CO2 PPT Presentation &
17. pass and else statements used with 01 Program TB2,VL2
loops. demonstration;
Flipped classroom
Module 3: SEQUENCES, SETS, DICTIONARIES AND REGULAR EXPRESSIONS

18 Sequences: Lists and operations – CO3 Program


TB1,RB2,
Creating, Inserting elements, 01 demonstration&
VL1,WR3
Updating elements Case study

19 CO3 PPT Presentation &


TB1,RB2,
Deleting elements, 01 Program
VL1,WR3
demonstration

20 CO3 PPT Presentation &


01 Program TB1,RB2,
Searching and sorting, List
demonstration; VL1
comprehensions, Nested lists; Flipped
classroom

Tuples -Creating, Searching and Program TB1,RB2,


21 01 CO3
sorting, Nested tuples; Demonstration VL1,WR3

22 Strings – Initializing a string and CO3 PPT Presentation &


TB1,RB2,
string operations, String handling 01 Program
Demonstration VL1,WR4
methods, String formatting.

23 CO3 PPT Presentation &


TB1,RB2,
Sets: Set creation, Set operations. 01 Program
VL1,WR4
Demonstration

24 CO3 PPT Presentation &


TB1,RB2,
Dictionaries: Operations on 01 Program
VL1,WR4
dictionaries, Dictionary methods, Demonstration
Sorting elements using lambdas.

25 Regular Expressions: Regular CO3 PPT Presentation &


TB1,RB2,
expressions, 01 Program
demonstration VL1,WR4
26 CO3 PPT Presentation &
01 Program TB1,RB2,
Sequence characters in regular
demonstration; VL1,WR4
expressions, Case study
27 PPT Presentation &
Program
Quantifiers in regular expressions, CO3 TB1,RB2,
01 demonstration;
VL1,WR4
Case study
28 PPT Presentation &
Special characters in regular Program
CO3 TB1,RB2,
expressions. 01 demonstration;
VL1,WR4
Case study

Module-4 FUNCTIONS AND FILE HANDLING


28 Functions: Need for functions,
PPT Presentation &
Function definition, TB1,RB3,
Program
01 CO4 VL1,WR4
demonstration
29
Function call, Variable scope and PPT Presentation &
lifetime, Return statement, CO4 Program TB1,RB3,
01
demonstration VL1,WR4
30 Pro Positional arguments, Keyword PPT Presentation&
arguments, CO4 Program TB1,RB3,
01 demonstration VL1,WR4
31
PPT Presentation &
Default arguments and variable TB1,RB3,
CO4 Program
length arguments, 01 demonstration VL1,WR4

32
PPT Presentation &
Recursive functions, Lambda TB1,RB3,
CO4 Program
functions, Generators. 01 VL1,WR4
demonstration
33 PPT Presentation &
File Handling: Types of files, CO4 Program TB1,RB3,
01 Demonstration VL1,WR5
34 PPT Presentation &
CO4 Program TB1,RB3,
Opening and closing files, 01 Demonstration VL1,WR5
35 PPT Presentation &
Reading and writing datababilistic
Reasoning over Time- Time and CO4 Program TB1,RB4,
01 VL1,WR5
Uncertainty Demonstration
36 PPT Presentation &
01 CO4 Program TB1,RB4,
With real time example task
Demonstration VL1,WR5

Module:5 OBJECT ORIENTED PROGRAMMING AND EXCEPTION HANDLING

37 CO5 PPT Presentation &


TB1,RB4,
Object Oriented Programming: 01 Program
VL1,WR5
Introduction to object-oriented demonstration
programming,

38 CO5 PPT Presentation &


TB1,RB4,
Classes and objects, 01 Program
VL1,WR6
demonstration
39 CO5 PPT Presentation &
TB1,RB4,
Inheritance and polymorphism, 01 Program
VL1,WR6
demonstration
40 CO5 PPT Presentation &
TB1,RB4,
Abstract Classes and interfaces. 01 Program
Demonstration VL1,WR6
41 Exception Handling: Errors in a CO5 PPT Presentation &
TB1,RB4,
python program, 01 Program
VL1,WR6
demonstration
TB1,RB4,
42 01 CO5 Blended Learning
Exceptions, Exception handling, VL1,WR6
43 CO5 PPT Presentation &
TB1RB4,
Types of exceptions, 01 Program
VL1
demonstration
44 CO5 PPT Presentation &
TB1RB4,
Except block, Assert statement 01 Program
VL1
demonstration
45 CO5 PPT Presentation &
User defined exceptions TB1RB4,
01 Program
VL1
demonstration
COURSE EVALUATION:

Marks
Marks to Max.
Duration in for
Evaluation Type Syllabus Minutes be Scaled Mark
Evaluati
to s
on
Mid-term Exam -1 Module -I&II 90Minutes 50 30
30*
Mid-term Exam -2 Module –III, IV&V 90Minutes 50 30

End Term Exam All Modules 180 100 50 50


Minutes
Experiential Content specified - 20 - 20
Learning above NA-

Total Marks 100

* For a total of 30 marks, 80% of better one of the two CIAT and 20% of the
other one is added and finalized, any fraction shall be rounded off to the higher
integer number.

You might also like