About Me

header ads

PYTHON PROGRAMMING (1BPLC105B/205B)

PYTHON PROGRAMMING

Course Code 1BPLC105B/205B 
Semester I/II
CIE Marks 50
Teaching Hours/Week (L:T:P: S) 3:0:2:0 
SEE Marks 50
Total Hours of Pedagogy (Theory and Lab hours) 40 + 24 (Practical) 
Total Marks 100
Credits 4 
Exam Hours 3
Examination type (SEE) Theory




Module-1

The way of the program: The Python programming language, what is a program? What is debugging? Syntax

errors, Runtime errors, Semantic errors, Experimental debugging.

Variables, Expressions and Statements: Values and data types, Variables, Variable names and keywords,

Statements, Evaluating expressions, Operators and operands, Type converter functions, Order of operations,

Operations on strings, Input, Composition, The modulus operator.

Iteration: Assignment, Updating variables, the for loop, the while statement, The Collatz 3n + 1 sequence,

tables, two-dimensional tables, break statement, continue statement, paired data, Nested Loops for Nested Data.

Functions: Functions with arguments and return values.

Chapters: 1.1-1.7, 2.1-2.12, 3.3, 4.4, 4.5

Number of Hours:8


Click here to download Module-1 


Module-2

Strings: Working with strings as single things, working with the parts of a string, Length, Traversal and the for

loop, Slices, String comparison, Strings are immutable, the in and not in operators, A find function, Looping and

counting, Optional parameters, The built-in find method, The split method, Cleaning up your strings, The string

format method.

Tuples: Tuples are used for grouping data, Tuple assignment, Tuples as return values, Composability of Data

Structures.

Lists: List values, accessing elements, List length, List membership, List operations, List slices, Lists are

mutable, List deletion, Objects and references, Aliasing, cloning lists, Lists and for loops, List parameters, List

methods, Pure functions and modifiers, Functions that produce lists, Strings and lists, list and range, Nested

lists, Matrices.

Chapter: 5.1, 5.2, 5.3

Number of Hours: 8


Click here to download Module-2


Module-3

Dictionaries: Dictionary operations, dictionary methods, aliasing and copying.

Numpy: About, Shape, Slicing, masking, Broadcasting, dtype.

Files: About files, writing our first file, reading a file line-at-a-time, turning a file into a list of lines, Reading

the whole file at once, working with binary files, Directories, fetching something from the Web.

Chapter: 5.4, 6.1-6.5, 7.1-7.8

Number of Hours:8


Click here to download Module-3



Module-4

Modules: Random numbers, the time module, the math module, creating your own modules, Namespaces,

Scope and lookup rules, Attributes and the dot Operator, Three import statement variants.

Mutable versus immutable and aliasing

Object oriented programming: Classes and Objects — The Basics, Attributes, Adding methods to our class,

Instances as arguments and parameters, Converting an instance to a string, Instances as return values.

Chapter: 8.1-8.8, 9.1, 11.1

Number of Hours: 8


Click here to download Module-4



Module-5

Object oriented programming: Objects are mutable, Sameness, Copying.

Inheritance: Pure functions ,Modifiers, Generalization, Operator Overloading, Polymorphism.

Exceptions: Catching Exceptions, Raising your own exceptions.

Chapter: 11.2.2-11.2.4, 11.3.2-11.3.9, 12.1, 12.2

Number of Hours:8


Click here to download Module-5



PRACTICAL COMPONENTS OF IPCC

1. a. Develop a python program to read 2 numbers from the keyboard and perform the basic arithmetic

operations based on the choice. (1-Add, 2-Subtract, 3-Multiply, 4-Divide).

b. Develop a program to read the name and year of birth of a person. Display whether the person is a

senior citizen or not.

2. a. Develop a program to generate Fibonacci sequence of length (N). Read N from the console.

b. Write a python program to create a list and perform the following operations

• Inserting an element

• Removing an element

• Appending an element

• Displaying the length of the list

• Popping an element

• Clearing the list

3. a. Read N numbers from the console and create a list. Develop a program to print mean, variance and

standard deviation with suitable messages.

b. Read a multi-digit number (as chars) from the console. Develop a program to print the frequency of

each digit with a suitable message.

4. Develop a program to print 10 most frequently appearing words in a text file. [Hint: Use a dictionary

with distinct words and their frequency of occurrences. Sort the dictionary in the reverse order of

frequency and display the dictionary slice of the first 10 items.

5. Develop a program to read 6 subject marks from the keyboard for a student. Generate a report that

displays the marks from the highest to the lowest score attained by the student. [Read the marks into

a 1-Dimesional array and sort using the Bubble Sort technique].

6. Develop a program to sort the contents of a text file and write the sorted contents into a separate text

file. [Hint: Use string methods strip(), len(), list methods sort(), append(), and file methods open(),

readlines(), and write()].

7. Develop a function named DivExp which takes TWO parameters a, b, and returns a value c (c=a/b).

Write a suitable assertion for a>0 in the function DivExp and raise an exception for when b=0. Develop

a suitable program that reads two console values and calls the function DivExp.

8. Define a function that takes TWO objects representing complex numbers and returns a new complex

number with the sum of two complex numbers. Define a suitable class ‘Complex’ to represent the

complex number. Develop a program to read N (N >=2) complex numbers and to compute the addition

of N complex numbers.

9. Text Analysis Tool: Build a tool that analyses a paragraph: frequency of each word, longest word,

number of sentences, etc.

10. Develop Data Summary Generator: Read a CSV file (like COVID data or weather stats), convert to

dictionary form, and allow the user to run summary queries: max, min, average by column.

11. Develop Student Grade Tracker: Accept multiple students’ names and marks. Store them in a list of

tuples or dictionaries. Display summary reports (average, topper, etc.).

12. Develop a program to display contents of a folder recursively (Directory) having sub-folders and files (name and type).




Suggested Learning Resources: 

Text books:

1. Peter Wentworth, Jeffrey Elkner, Allen B. Downey and Chris Meyers- How to think like a computer

scientist: learning with python 3. Green Tea Press, Wellesley, Massachusetts,2020

https://media.readthedocs.org/pdf/howtothink/latest/howtothink.pdf



Reference books / Manuals:

1. Al Sweigart,“ Automate the Boring Stuff with Python, 2nd Edition: Practical Programming for Total

Beginners”,2nd Edition, No Starch Press, 2022. (Available under CC-BY-NC-SA license at

https://automatetheboringstuff.com/)

2. Kyla McMullen, Elizabeth Matthews and June Jamrich Parsons, Programming with Python, Cengage,

2023.

Post a Comment

0 Comments