0% found this document useful (0 votes)
21 views9 pages

Python Programming Course Syllabus

The document outlines the syllabus for the Python Programming course (211CSE1402), detailing course objectives, outcomes, and a comprehensive weekly plan. It covers fundamental programming concepts, data structures, functions, object-oriented programming, and data processing techniques using Python. Additionally, it includes practical assignments, projects, and experiments to reinforce learning and application of Python skills.

Uploaded by

Harpreet Singh.
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)
21 views9 pages

Python Programming Course Syllabus

The document outlines the syllabus for the Python Programming course (211CSE1402), detailing course objectives, outcomes, and a comprehensive weekly plan. It covers fundamental programming concepts, data structures, functions, object-oriented programming, and data processing techniques using Python. Additionally, it includes practical assignments, projects, and experiments to reinforce learning and application of Python skills.

Uploaded by

Harpreet Singh.
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

1.

2 211CSE1402: PYTHON PROGRAMMING

211CSE1402 Python Programming L T P X C


1 0 2 3 3
Pre-requisite :NIL
Course Category :Foundation Core
Course Type :Integrated Course - Theory

COURSE OBJECTIVES:
• To learn how to use lists, tuples, and dictionaries in Python programs.

• To learn how to identify Python object types.

• To learn how to use indexing and slicing to access data in Python programs.

• To define the structure and components of a Python program.

• To learn how to write loops and decision statements in Python.

• To learn how to write functions and pass arguments in Python.

• To learn how to build Python modules for reusability.

• To learn how to read and write files in Python.

• To learn how to design object-oriented programs with Python classes.

• To practice data processing, analysis and visualization with python

COURSE OUTCOMES:
CO1: Understand the constructs and concepts of a programming language

CO2: Apply Python data structures for problem solving and programming

CO3: Implement user defined python functions and build an efficient program leveraging
modules

CO4: Create python programs to handle file I/O and exceptions, and solve problems with
Object Oriented Concepts

CO5: Understand Data processing, Validation, Visualization concepts in python with


regex, pandas, matplotlib and numpy packages.

21
MAPPING OF COURSE OUTCOMES WITH PO, PSO:
PO’S
1 2 3 4 5 6 7 8 9 10 11 12
CO1 S S S
CO2 S S S
CO3 S M M M
CO4 S S S S S
CO5 S M M S M S

UNIT I: Getting Started with Programming


Introduction, Python Versions, Applications of Python in mainstream technologies.
Strings and Formatting: Basic Syntax, Comments, String Values, String Methods,
The format Method, String Operators, Numeric Data Types, Conversion Functions, Sim-
ple Output, Simple Input, The % Method, The print Function
Language Components: Indenting Requirements, the if Statement, Relational and Logical
Operators, Bit Wise Operators, the while Loop, break and continue, The for Loop.

UNIT II: Python Data Structures


Introduction to Python Data Structures, Lists, Tuples, List Comprehensions, Nested List
Comprehensions, Sets, Dictionaries, Sorting Dictionaries, Copying Collections, Dic-
tionary Comprehensions, Dictionaries with Compound Values

UNIT III: Functions and Modules


Functions: Introduction, Defining Your Own Functions, Parameters, Function Docu-
mentation, Keyword and Optional Parameters, Passing Collections to a Function, Vari-
able Number of Arguments, Scope, Functions - ”First Class Citizens”, Passing Functions to
a Function, map, filter, Mapping Functions in a Dictionary, Lambda, Inner Functions,
Closures
Modules: Modules, Standard Modules – sys, math, time, The dir Function

UNIT IV: Exceptions, I/O and OOP


Exceptions: Errors, Runtime Errors, The Exception Model, Exception Hierarchy, Han- dling
Multiple Exceptions, raise, assert.
Input and Output: Introduction, Data Streams, Creating Your Own Data Streams, Access
Modes, Writing Data to a File, Reading Data from a File
Object Oriented Programming: Class Coding Basics Class Statement Methods In-
heritance Attribute Tree Construction Specializing Inherited Methods Class Interface
Techniques Abstract Super Classes

UNIT V: Data Processing, Analysis and Visualization


Regular Expressions: Introduction, Simple Character Matches, Special Characters,
Character Classes, Quantifiers, The Dot Character, Greedy Matches, Grouping, Match-

22
ing at Beginning or End, Match Objects, Substituting, Splitting a String, Compiling Regular
Expressions, Flags.
Numerical Analysis & Plotting: Numpy – Overview, Setup, Datatypes, Basic Op- erators,
Indexing, Broadcasting, Matrix Operators. Matplotlib-Overview, Setup, Basic plots,
Customizing plots, Subplots, 3D plots.
Data Processing with Pandas: Pandas – Overview, Setup, Data Structures, Indexing
& Selecting Data, groupby Operations, Reshaping data.

X Component
• Competitive coding using Core Python – Practical Assignments and Hacker-
rank challenges

• GUI Development using Python – Project

Syllabus for GUI Development


An Example GUI, The Tk Widget, Button Widgets, Entry Widgets, Text Widgets,
Checkbutton Widgets, Radiobutton Widgets, Listbox Widgets, Frame Widgets, Menu
Widgets, Toplevel Widgets, Dialogs

15 WEEK COURSE PLAN

Week Lecture (1 Pedagogy Practical (2 X Component (3


hours) hours) hours)
Introduction Explicit Python Ver- Access and
Week 1 to Python – Teaching sions, Installing perform
Applications Python, Envi- operations on
of Python in ronment Vari- Open Source
Mainstream ables, Executing Environments
Technologies Python from the like Raspberry
Command Line Pi
Strings in Explicit String functions
Python Teaching/ and formatting
Demon-
stration
Language Com- Explicit Indenting Re-
ponents – Part Teaching quirements, the
01: Simple if if Statement
Language Com- Explicit while Loop, Provide
Week 2
ponents – Part Teaching/ break and con- programming
02: Relational Demon- tinue, for Loop solution for
and Logical stration decision and
Operators, Bit looping problem
Wise Operators scenarios

23
Lists, Tuples Explicit Hands-on ses-
Teaching sion for Lists
and Tuples
- methods
and functions
Hackerrank –
Problem Solving
Challenge
Sets, Dictionary Explicit Hands-on ses- Create solutions
Week 3
Teaching sion for Sets for complex
and Dictionary problem
- methods and statements
functions leveraging
Comprehension Explicit List Comprehen- Python Data
Teaching sion, Dictionary structures
Comprehen-
sion, Lambda,
Hackerrank –
Problem Solving
Challenge
Functions Explicit Getting started Apply
Week 4
Teaching with function the buit-in and
oriented pro- user defined
gramming functions to
create efficient
programs lever-
aging Python
modules.
Modules Explicit Modular Pro-
Teaching gramming,
Built-in Mod-
ules
Exceptions Explicit Practicing pro- Get data from
Week 5
Teaching grams that are sensors through
robust against Raspberry Pi,
exceptional in- with
puts appropriate
Input/Output Explicit Getting data Exceptional
Teaching out from Excel, Handling
Notepad
Week 6 Object Oriented Explicit Attribute Tree Create Object
Programming: Teaching Construction Oriented Solu-
Class Statement Specializing tion for solving
Methods Inheri- Inherited Meth- application ori-
tance ods, Class ented problems
Interface Tech-
niques Abstract
Super Classes

24
Regular Expres- Explicit Practicing Validate data
Week 7
sions, Simple Teaching regular using RegExp
Character expression rules package for
Matches, Spe- for different realtime inputs,
cial Characters, problem from integrated
Character scenarios environment
Classes, Quan-
tifiers, The Dot
Character
Greedy Matches, Explicit
Grouping, Teaching
Matching at
Beginning or
End, Match
Objects, Substi-
tuting, Splitting
a String, Com-
piling Regular
Expressions,
Flags.
Week 8 Numerical Anal- Explicit Performing op- Perform com-
ysis, Datatypes, Teaching erations on data plex mathetical
Basic Opera- frames obtained operations lever-
tors, Indexing, from real time aging Numpy
Broadcasting, datasets
Matrix Opera-
tors.
Week 9 Plotting, Basic Explicit Practicing data Perform data
plots, Customiz- Teaching plots for Real visualization on
ing plots, Sub- time datasets streaming data
plots, 3D plots
Week 10 Data Processing, Explicit Working with Process data
Data Structures, Teaching data processing from benchmark
Indexing & operations using sites using Pan-
Selecting Data, Pandas das, Numpy,
groupby Opera- Matplotlib
tions, Reshaping
data.

25
Week 11 Tkinter: Tk Explicit Tkinter Pro- Create a
Widget, Button Teaching gramming for UI well-defined user
Widgets, Entry Snips interface, based
Widgets, Text on the problem
Widgets, Check- requirement
button Widgets, (GUI
Radiobutton Development)
Widgets, List-
box Widgets,
Frame Widgets,
Menu Widgets,
Toplevel Wid-
gets, Dialogs
Week 12 Developing User Explicit Efficient UI
Interface with Teaching Development
OOP using Tkinter
and OOP
Week 13 Desktop App Project Problem Identification and Backend details
Development Based
Learning
Week 14 Creating own Project Pip, PyPi, Licence Reception
Python Pack- Based
ages Learning
Week 15 UI Development Project UI Development for Integrated Application
Based
Learning

EXPERIMENTS:
1. Let d(n) be defined as the sum of proper divisors of n (numbers less than n which
divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each
of a and b are called amicable numbers.
For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and
110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so
d(284) = 220.
Find the count of the matching proper divisors of the given amicable number
2. We come across varying magic numbers or so called occult numbers. There arevery
few numbers in having a particular property. The so called occult number inour
scenario is the number, whose individual digits’ factorial sum will give back the same
number.
For instance: 40585 = 4! + 0! + 5! + 8! + 5! = 40585
Calculate the number of occult numbers in the less than a particular value ’alpha’
Alpha will be given in the input

26
3. A positive integer, n, is factorised into prime factors. We define f(n) to be the
product when each prime factor is replaced with 2. In addition we define f(1)=1.
For example, 90=2*3*3*5, then replacing the primes, 2*2*2*2=16, hence f(90)=16.
Calculate f(n), for the given n

4. Each new term in the Fibonacci sequence is generated by adding the previous two
terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed
four million, find the sum of the even-valued terms upto the given V terms series.

5. Namonical charge is a value that is calculated by inputting the name of the person.
The charge is calculated by first coverting the characters in the name to its corre-
sponding alphabetical position and then accumulating a sum based on the following
rules:
(i) if the number is even, take factorial of it
(ii) if the number is odd, take the square root of the number
The accumulated sum is returned as the Namonical charge of the given name
Eg.
name = ”abcd”
a - 1 (odd, take square root)
b - 2 (even, take factorial)
c - 3 (odd, take square root)
d - 4 (even, take factorial)
Namonical charge = sqrt(1) + factorial (2) + sqrt(3) + factorial(4) = 28.732
Note: Round the output to three decimal digits

6. For a positive integer n, define f(n) to be the number of non-empty substrings of n that
are divisible by 3. For example, the string ”2573” has 10 non-empty substrings, three of
which represent numbers that are divisible by 3, namely 57, 573 and 3. So f(2573)=3.
If f(n) is divisible by 3 then we say that n is 3-like.
If the given number is 3-like, print ’yes’, otherwise print ’no’

7. Natural Numbers are simply the numbers 1, 2, 3, 4, 5, ... (and so on).


Given a number k and N, take sum of all numbers less than or equal to N, that are
divisible by k.
Example:
Given k = 5, N = 10, the natural numbers less than or equal to 10 and divisible by
5 are 5,10
The sum is 5+10=15
8. Sorting is a base for any problem solving. Sorting can be done in ascending or
descending order. Various algorithms exist in the literature to do the sorting effi-
ciently.
Create a sorting algorithm that sorts elements between a particular range (i,j)
Example:
Given the inputs
7 // Number of elements

27
5 2 6 3 9 1 7 // The array (index starts from zero)
2 // Start range
5 // end range
Output:
5236917
9. Convert the given word into magnet word. Magnet word is a word which will have
a property.
Each character of the word will be assigned index starting from 1.
Alphabets in English will be numbered from index 1.
Reverse of the multiplied indices of the character in string and alphabers, mod 26
gives the corresponding magnetic character.
Replace all the characters in the given string with its magnetic character, resulting
in magnetic word.
Note: If a character is changed to magnetic once, all its subsequents appearances
will have the same magnetic character.
(space character remains untouched)
The elements between the range 2 and 5-1 are sorted
10. Ak gave a challenge to Vj. Ak gave a decimal number N.
Vj needs to find the product of unique critical digits of the number N.
Critical digits are those digits which are divisible by X.
The value X is 2, if the number of unique even numbers is greater than those of
unique odd numbers, else, the value of X is 1.
Help Vj to crack the challenge.
Eg. N = 123564.2654916465
If the count of numbers to the left of . (dot) is greater than the count of numbers
to the right, then . (dot) is considered as even number. Else . (dot) is consideredas
odd number. In above case, . (dot) is considered as odd number.

11. n! means n × (n - 1) × ... × 3 × 2 × 1


For example, 20! = 2432902008176640000,
The number is so long. We need to compress this number in such a way that much
information is not last.
Essential information of the number is its case: even or odd. We shall preserve the
highest case in the given number (i.e.,) if the number of even numbers is greater
than the odd, then even is the highest case, and vice versa.
The resultant compressed number should have unique numbers in ascending order.
12. RSK is going to play KPL in 2021. RSK consist of many players in its player pool
in different type: batsman, bowler, wicket keeper and all-rounder. Each player will
have a X factor determining his own strength. In addition to strength, the mode of
the player, either aggressive or defensive will also be provided.
Team RSK management and its captain is in ambiguity on how to select their best
team. The selected team should be highly competent in the tournament. A team
can be competent enough only when it has competent players in aggressive mode.
Given with the set of team player details including their X factor, mode and type,
the task is to form an optimal team.
A team should require minimum two batsmen, one bowler and one wicket keeper

28
out of its 11 field players. Team should contain minimum 4 aggressive players Note: An
all-rounder can be accounted as either batsmen or bowler
Help team RSK management to finds its best 11-squad to win the trophy. Prove
to the management by selecting a optimal team with highest cumulative x-factor
value

TEXT BOOK(S):
1. Mark Lutz, “Learning Python”, Fifth Edition, O,Reilly, 2018

REFERENCES:
1. Charles Severance, 2016, Python for everybody: exploring data in Python 3

2. Charles Dierbach, 2013, Introduction to Computer Science using Python: a com-


putational problem-solving focus, Wiley Publishers

29

Common questions

Powered by AI

To manage unexpected exceptions in a Python file I/O operation, implement a strategy leveraging try, except, and finally blocks. Use a try block to encapsulate the file operation, such as reading or writing, ensuring it is attempted. In the except block, handle specific exceptions like FileNotFoundError or IOError, providing feedback or fallbacks. Additionally, a finally block should be used to ensure cleanup actions like file closure occur regardless of success or failure. This approach ensures robust error handling, maintaining program stability and resource management .

Python’s object-oriented programming support allows method specialization through inheritance, where a subclass can override methods from its superclass to alter or enhance behavior. This allows for polymorphism, where different subclasses can offer different implementations of shared methods, thus customizing and specializing functionality as needed while maintaining a common interface. This specialization is critical for designing flexible and reusable software components .

List comprehensions in Python provide a concise way to create lists by iteratively applying an expression on each element of an existing collection, often coupled with a condition for filtering. This reduces the need for lengthy loops and makes the code more readable and efficient. They can handle nested structures and support complex operations like merging, filtering, and transforming data in a single line, which is particularly useful for solving complex problems efficiently .

Tkinter is beneficial for GUI development in Python due to its simplicity and effectiveness in building cross-platform applications. Its built-in widgets and layout features allow developers to create standard interfaces without additional dependencies. However, the challenges include limited styling options compared to modern web-based UI frameworks and a steeper learning curve for complex designs. Tkinter requires understanding of event-driven programming to effectively manage user interactions, which can be challenging for beginners .

Pandas and Numpy significantly impact data processing and analysis by providing high-performance, easy-to-use data structures and analysis tools. Pandas offer DataFrame objects that allow for efficient data manipulation, cleaning, and aggregation, outperforming traditional Python lists or dictionaries in handling large datasets. Numpy extends this capability with multi-dimensional arrays and matrix operations, facilitating complex mathematical modeling and numerical work. Together, these libraries enhance productivity, allowing Python to process and analyze large data sets efficiently, which is critical in data-driven domains .

Competitive programming assignments are significant in mastering Python programming concepts because they provide real-world problem-solving scenarios that require efficient algorithmic thinking and application of core Python features. These challenges help in understanding and implementing data structures, control flows, and Python’s syntax under constraints, which enhances coding skills and technical depth. Furthermore, exposure to these assignments refines students' capability to write clean, optimized code and prepare for real-world programming challenges .

Regular expressions (regex) play a crucial role in data validation and manipulation by providing a mechanism to search, parse, and modify text using patterns. They are used extensively in input validation to ensure data integrity by defining specific character sequences that inputs must match. Additionally, regular expressions enable complex text processing operations such as splitting, replacing, and extracting substrings from data streams, making them a powerful tool for text manipulation tasks in Python applications .

Python can be used to design algorithms for sports team selection by processing and analyzing player statistics to optimize team performance. By using libraries like Pandas for data handling and calculations, it is possible to evaluate different attributes such as player skill levels, modes of play, and x-factors. The algorithm can include constraints on player categories, ensuring balance (like requiring batsmen or bowlers). Python's OOP features can model players as objects, allowing for an adaptable framework to simulate and optimize team strategies dynamically .

Python modules enhance reusability and efficiency by allowing code to be organized into separate files which can be imported and reused across different parts of a project or in different projects. This modularity helps in maintaining code and reducing redundancy. Modules also encapsulate functionality, making programs easier to understand and manage. They support built-in functions and can include third-party libraries, extending Python’s capabilities and promoting efficient programming practices .

3D plots in Python’s Matplotlib library enhance the understanding of complex datasets by providing an additional dimension to visualize data, unveiling patterns and relationships that might not be evident in 2D plots. They are particularly useful for showcasing multi-variable data, allowing dynamic visualization that can be rotated to view from different angles, thus offering a more comprehensive insight into data structure and inter-variable interactions. Such visualizations are invaluable in fields like engineering and data science, where data complexity is abundant .

You might also like