COURSE INFORMATION
Course Code: CS/UCS/22/S3/PSUP
Course Name: Problem Solving using Python
LTP: 4-0-0
Credits: 4
Session: B. Tech. – CSE (2025-2026 Autumn)
Time and Venue:
DAY 0930-1030 1035-1135 1140-1240 1400-1500 1500-1600 1600-1700
MONDAY
TUESDAY THEORY
LAB 6
WEDNESDAY
THURSDAY THEORY
LAB 6
FRIDAY THEORY
LAB 6
Course Description
This course provides an introduction to programming and the Python language. Students are
introduced to core programming concepts like data structures, conditionals, loops, variables,
and functions. This course includes an overview of the various tools available for writing and
running Python, and gets students coding quickly. It also provides hands-on coding exercises
using commonly used data structures, writing custom functions, and reading and writing to
files. This course may be more robust than some other introductory python courses, as it
delves deeper into certain essential programming topics.
It is a mixed course (theory and practical) and therefore, each topic will be covered first as a
two hour theory session and then as a hands-on practical session for two hours. The theory
session will also contain programming examples.
In each lab session students will be asked to solve a few programming problems. They have to
solve the problems with the help of the instructor and the lab assistant. At the end a sample
solution will be given to the students.
Prerequisites
Basic knowledge in mathematics
Course Outcomes (CO)
After the course the students are expected to be able to (this is what the exams will test) :
● Identify core aspects of programming and features of the Python language
● Understand and apply core programming concepts like data structures, conditionals,
loops, variables, and functions
● Use different tools for writing and running Python code
● Design and write fully-functional Python programs using commonly used data
structures, custom functions, and reading and writing to files
Course Contents (Syllabus)
Module I: Installation and Troubleshooting [2L]
Setting up Programming Environment, Python on Windows, macOS, and Linux, Text editors
and IDEs, Customizing Sublime Text Settings, IDLE, PyCharm, Jupyter Notebook, Google
Notebook, Running Python Programs from a Terminal
Module II: Variables and Simple Data Types [2L]
Naming and Using Variables, Avoiding Name Errors, Strings, Changing Case, Adding
Whitespace to Strings, Stripping Whitespace, Avoiding Syntax Errors with Strings, Numbers,
Integers, Floats, Underscores in Numbers, Multiple Assignments, Constants, Comments
Module III: Working with Lists [4L]
Accessing elements using index and values, Changing, Adding, and Removing Elements,
Organizing, Sorting Permanently and Temporarily, Printing in Reverse Order, Length of a List,
Looping Through an Entire List, Avoiding Indentation Errors, Forgetting Indentation and
Indenting Unnecessarily, Making Numerical Lists, range function, working with part of a List,
Slicing, Looping through a Slice, Copying a List, Tuples, Looping through all values in a Tuple,
Writing over a tuple
Module IV: If statements, Dictionaries, User Input and while loops [7L]
Conditional Tests, checking for equality and ignoring case, Checking for inequality, Numerical
Comparisons, Checking Multiple Conditions, Checking whether a value is in a list and is not in
a list., Simple If statements, if-else statements, The if-elif-else statements, Multiple elif Blocks,
Using if Statements with Lists, Checking for special items, Checking that a list is not empty,
Using multiple lists, Working with Dictionary, accessing values, adding new key-value pairs,
empty dictionary, modifying values in a dictionary, removing key-value pairs, dictionary with
similar objects, Looping through a dictionary, looping through all key-value pairs, all the keys,
all the keys in a particular order, all values., A list of dictionaries, a list in a dictionary, a
dictionary in a dictionary, input() function, numerical input, modulo operator, While loops,
Using flag, break and continue., Using a while loop with lists and dictionaries, moving items
from one list to another, removing all instances of a specific value from a list, filling a
dictionary with user input.
Module V: Functions [4 L]
Defining, Passing information, arguments and parameters, Passing arguments, positional and
keyword arguments, default values, equivalent function calls, avoiding argument errors,
Return simple values, making an argument optional, returning a dictionary, using a function
with a while loop, Passing a list, modifying a list in a function, preventing a function from
modifying a list, Passing an arbitrary number of arguments, mixing positional and arbitrary
arguments, using arbitrary keyword arguments., Storing functions in modules, importing
entire and specific module, alias in function and module, importing all functions in a module.
Module VI: Classes [4 L]
Creating and using a class, making an instance from a class, Working with classes and
instances, setting default value for an attribute, modifying attribute values, Inheritance, The
init() method for a child class, Overriding methods from the parent class, instances as
attributes, Importing classes, Importing single and multiple classes, storing multiple classes in
a module, Importing an entire module, all classes from a module, module in a module, aliases
Module VII: Files and Exceptions [2 L]
Reading from a file, entire file, file paths, reading line by line, making list from a file., Writing
to a file, empty file and multiple lines, Exceptions, ZeroDivisionError Exception, try-except
blocks, else block, FileNotFoundError Exception, multiple files, failing silently.
Module VIII: Numpy [9 L]
Understanding Data Types in Python, Creating Arrays from Python Lists, Creating Arrays from
Scratch, The Basics of Numpy Arrays, Array Indexing, Slicing, Reshaping, Concatenation and
Splitting, Computation on Numpy Arrays: Universal Functions, Slowness of Loops, Exploring
Numpy’s UFuncs, Aggregation: Min, Max, and Everything in Between, Summing the Values in
an Array, Minimum and Maximum, Computation on Arrays: Broadcasting, Rules of
Broadcasting, Comparisons, Masks, and Boolean Logic, Comparison Operators as ufuncs,
Boolean Arrays as Masks.
Module IX: Pandas [8 L]
Pandas: Introducing Pandas Objects, The Pandas Series Object, The Pandas DataFrame Object,
The Pandas Index Object, Data Indexing and Selection, Selection in Series, Selection in
DataFrame, Operating on Data in Pandas, Ufuncs: Index Preservation, Ufuncs: Index
Alignment, Ufuncs: Operation Between DataFrame and Series, Handling missing Data, Missing
Data in Pandas, Operating on null values, Combining Datasets, Concat and Append, Combining
Datasets, Merge and Join, Categories of Joins, Merge Key, Aggregation and Grouping, Group by,
Split, Apply, Combine.
Module X: Data Visualization using MatPlotLib [5 L]
Installing Matplotlib, Plotting line graph, label type and line thickness, correcting, Built-in
styles, scatter(), styling individual and series of points, custom colors, colormap, saving plots.,
Random walks, directions, plotting, multiple walks, styling, Plotly, installing, histogram,
Downloading data, CSV file, parsing, Extracting and reading data, plotting data in a temp plot,
datetime module, plotting dates, longer timeframe, second data series, shading area, error
checking, downloading own data, Mapping global data sets, JSON, earthquake data, extracting
location data, building world map, customizing marker size and colors.
LECTURE PLAN
Lecture Handout, Lecture Notes,
Details of coverage
No. Links etc.
Installation and Troubleshooting: Setting up Programming Lecture on Board, Example
1 Environment, Python on Windows, macOS, and Linux, Text Demonstration in Jupyter
editors and IDEs, Notebook
Installation and Troubleshooting: Customizing Sublime Text Lecture on Board, Example
2 Settings, IDLE, PyCharm, Jupyter Notebook, Google Demonstration in Jupyter
Notebook, Running Python Programs from a Terminal Notebook
Installation and Troubleshooting: Naming and Using Lecture on Board, Example
3 Variables, Avoiding Name Errors, Strings, Changing Case, Demonstration in Jupyter
Adding Whitespace to Strings, Stripping Whitespace Notebook
Installation and Troubleshooting: Avoiding Syntax Errors Lecture on Board, Example
4 with Strings, Numbers, Integers, Floats, Underscores in Demonstration in Jupyter
Numbers, Multiple Assignments, Constants, Comments Notebook
Variables and Simple Data Types: Accessing elements using Lecture on Board, Example
5 index and values, Changing, Adding, and Removing Demonstration in Jupyter
Elements Notebook
Variables and Simple Data Types: Organizing, Sorting Lecture on Board, Example
6 Permanently and Temporarily, Printing in Reverse Order, Demonstration in Jupyter
Length of a List Notebook
Variables and Simple Data Types: Looping Through an Entire
Lecture on Board, Example
List, Avoiding Indentation Errors, Forgetting Indentation and
7 Demonstration in Jupyter
Indenting Unnecessarily, Making Numerical Lists, range ()
Notebook
function
Variables and Simple Data Types: working with part of a List, Lecture on Board, Example
8 Slicing, Looping through a Slice, Copying a List, Tuples, Demonstration in Jupyter
Looping through all values in a Tuple, Writing over a tuple Notebook
If statements, Dictionaries, User Input and while loops: Lecture on Board, Example
9 Conditional Tests, checking for equality and ignoring case, Demonstration in Jupyter
Checking for inequality, Numerical Comparisons Notebook
If statements, Dictionaries, User Input and while loops:
Lecture on Board, Example
Checking Multiple Conditions, Checking whether a value is
10 Demonstration in Jupyter
in a list and is not in a list., Simple If statements, if-else
Notebook
statements
If statements, Dictionaries, User Input and while loops: The
Lecture on Board, Example
if-elif-else statements, Multiple elif Blocks, Using if
11 Demonstration in Jupyter
Statements with Lists, Checking for special items, Checking
Notebook
that a list is not empty, Using multiple lists
If statements, Dictionaries, User Input and while loops:
Working with Dictionary, accessing values, adding new Lecture on Board, Example
12 key-value pairs, empty dictionary, modifying values in a Demonstration in Jupyter
dictionary, removing key-value pairs, dictionary with Notebook
similar objects
If statements, Dictionaries, User Input and while loops: Lecture on Board, Example
13 Looping through a dictionary, looping through all key-value Demonstration in Jupyter
pairs, all the keys, all the keys in a particular order, all Notebook
values., A list of dictionaries, a list in a dictionary, a
dictionary in a dictionary
If statements, Dictionaries, User Input and while loops: Lecture on Board, Example
14 input() function, numerical input, modulo operator, While Demonstration in Jupyter
loops, Using flag, break and continue. Notebook
If statements, Dictionaries, User Input and while loops: Using
Lecture on Board, Example
a while loop with lists and dictionaries, moving items from
15 Demonstration in Jupyter
one list to another, removing all instances of a specific value
Notebook
from a list, filling a dictionary with user input.
Functions: Defining, Passing information, arguments and Lecture on Board, Example
16 parameters, Passing arguments, positional and keyword Demonstration in Jupyter
arguments Notebook
Functions: default values, equivalent function calls, avoiding Lecture on Board, Example
17 argument errors, Return simple values, making an argument Demonstration in Jupyter
optional Notebook
Functions: using a function with a while loop, Passing a list,
Lecture on Board, Example
modifying a list in a function, preventing a function from
18 Demonstration in Jupyter
modifying a list, Passing an arbitrary number of arguments,
Notebook
mixing positional and arbitrary arguments
Functions: Storing functions in modules, importing entire Lecture on Board, Example
19 and specific modules, alias in function and module, Demonstration in Jupyter
importing all functions in a module. Notebook
Lecture on Board, Example
Classes: Creating and using a class, making an instance from
20 Demonstration in Jupyter
a class, Working with classes and instances
Notebook
Classes: setting default value for an attribute, modifying Lecture on Board, Example
21 attribute values, Inheritance, The init() method for a child Demonstration in Jupyter
class, Overriding methods from the parent class Notebook
Classes: Overriding methods from the parent class, instances Lecture on Board, Example
22 as attributes, Importing classes, Importing single and Demonstration in Jupyter
multiple classes Notebook
Classes: storing multiple classes in a module, Importing an Lecture on Board, Example
23 entire module, all classes from a module, module in a Demonstration in Jupyter
module, aliases Notebook
Files and Exceptions: Reading from a file, entire file, file Lecture on Board, Example
24 paths, reading line by line, making list from a file., Writing to Demonstration in Jupyter
a file, empty file and multiple lines Notebook
Files and Exceptions: Exceptions, ZeroDivisionError Lecture on Board, Example
25 Exception, try-except blocks, else block, FileNotFoundError Demonstration in Jupyter
Exception, multiple files, failing silently. Notebook
Mid Semester Examination
Numpy: Introduction to Numpy, Understanding Data Types Lecture on Board, Example
26 in Python, A Python Integer is more than just an integer, A Demonstration in Jupyter
Python list is more than just a list. Notebook
Numpy: Fixed-Type Arrays in Python, Creating Arrays from Lecture on Board, Example
27 Python Lists, Creating Arrays from Scratch, Numpy standard Demonstration in Jupyter
data types Notebook
Numpy: The Basics of Numpy Arrays, Numpy Array
Lecture on Board, Example
Attributes, Array Indexing: Accessing Single Elements,
28 Demonstration in Jupyter
Slicing: Accessing Subarrays, Reshaping, Concatenation and
Notebook
Splitting
Numpy: Reshaping of Arrays, Array Concatenation and Lecture on Board, Example
29 Splitting, Computation on Numpy Arrays: Universal Demonstration in Jupyter
Functions, Slowness of Loops Notebook
Lecture on Board, Example
30 Numpy: Introducing UFuncs, Exploring Numpy’s UFuncs Demonstration in Jupyter
Notebook
Lecture on Board, Example
Numpy: Advanced Ufunc Features, Aggregation: Min, Max,
31 Demonstration in Jupyter
and Everything in Between
Notebook
Lecture on Board, Example
Numpy: Computation on Arrays: Broadcasting, Rules of
32 Demonstration in Jupyter
Broadcasting
Notebook
Lecture on Board, Example
Numpy: Broadcasting in practice, Comparisons, Masks, and
33 Demonstration in Jupyter
Boolean Logic, Comparison Operators as ufuncs
Notebook
Lecture on Board, Example
Numpy: Working with Boolean Arrays, Boolean arrays as
34 Demonstration in Jupyter
masks, Sorting Arrays, Fast sorting, Partial Sorting
Notebook
Lecture on Board, Example
Pandas: Introducing Pandas Objects, The Pandas Series
35 Demonstration in Jupyter
Object.
Notebook
Lecture on Board, Example
Pandas: The Pandas DataFrame Object, The Pandas Index
36 Demonstration in Jupyter
Object.
Notebook
Lecture on Board, Example
Pandas: Data Indexing and Selection, Selection in Series,
37 Demonstration in Jupyter
Selection in DataFrame.
Notebook
Pandas: Operating on Data in Pandas, Ufuncs: Index Lecture on Board, Example
38 Preservation, Ufuncs: Index Alignment, Ufuncs: Operation Demonstration in Jupyter
Between DataFrame and Series Notebook
Lecture on Board, Example
Pandas: Handling missing Data, Missing Data in Pandas,
39 Demonstration in Jupyter
Operating on null values
Notebook
Lecture on Board, Example
40 Pandas: Combining Datasets, Concat and Append Demonstration in Jupyter
Notebook
Lecture on Board, Example
Pandas: Combining Datasets, Merge and Join, Categories of
41 Demonstration in Jupyter
Joins, Merge Key
Notebook
Lecture on Board, Example
Pandas: Aggregation and Grouping, Group by, Split, Apply,
42 Demonstration in Jupyter
Combine,
Notebook
Lecture on Board, Example
Data Visualization using MatPlotLib: Installing Matplotlib,
43 Demonstration in Jupyter
Plotting line graph, label type and line thickness, correcting
Notebook
Data Visualization using MatPlotLib: Built-in styles, scatter(), Lecture on Board, Example
44 styling individual and series of points, custom colors, Demonstration in Jupyter
colormap, saving plots. Notebook
Data Visualization using MatPlotLib: Random walks,
Lecture on Board, Example
directions, plotting, multiple walks, styling, Plotly, installing,
45 Demonstration in Jupyter
histogram, Downloading data, CSV file, parsing, Extracting
Notebook
and reading data, plotting data in a temp plot
Data Visualization using MatPlotLib: datetime module, Lecture on Board, Example
46 plotting dates, longer timeframe, second data series, shading Demonstration in Jupyter
area, error checking, downloading own data Notebook
Data Visualization using MatPlotLib: Mapping global data Lecture on Board, Example
47 sets, JSON, earthquake data, extracting location data, Demonstration in Jupyter
building world map, customizing marker size and colors Notebook
End Semester Examination
Textbooks
1. Python Programming, Problem Solving, Packages and Libraries by Anurag Gupta and G
P Biswas, McGraw Hill Publications
Reference Books
1. Python Crash Course A Hands on Project Based Introduction to Programming by Eric
Matthes, Second Edition, No Starch Press
2. Python Data Science Handbook by Jake VanderPlas, O’Reilly Publications
Mini Projects
A project list will be given to each group of students. Student groups will be formed before the
mid semester examination. The projects will be evaluated before the end semester
examination.
Full Signature of the Faculty Full Signature of the Dean, Academics