EC-PC403 – C Problem Solving Using PYHTON
TeachingScheme
Theory Hours Tutorialhoursper PracticalHours
Credit
Perweek week perweek
3 0 2 4
Prerequisite
Fundamentals of computer programming
Objectives
1. Discuss the Introduction and structure of Python Program
2. Explain the basic language constructs.
3. Discuss the Object Oriented Programming in Python
4. Explain the Inheriting classes in Python
5. Explain the File handling in Python
Learning Outcomes
1. Understand the primary fundamentals of Python programming
2. Understand the application of Object Oriented Programming in Python
3. Understand the Inheriting classes and file handling concepts in Python
Syllabus
1. Introduction to Python [6 Hrs]
The Programming Cycle for Python, Structure of Python Program, Type Conversion.
Basics: Expressions, Assignment Statement, Arithmetic Operators, Operator Precedence, Boolean
Expression.
2. Basic Language Constructs [14 Hrs]
Conditional statement in Python (if-else statement, its working and execution), Nested-if statement
and Elif statement in Python, Expression Evaluation.
14
Loops : Purpose and working of loops, While loop including its working, For Loop, Nested Loops,
Break and Continue.
Function: Parts of a Function, Execution of a Function , Keyword and Default Arguments ,
Scope Rules. Iterators & Recursion.
Strings: Length of the string and perform Concatenation and Repeat operations in it. Indexing
and Slicing of Strings, Tuples, Unpacking Sequences, Lists, Mutable Sequences, List
Comprehension, Sets and Dictionaries.
3. Object Oriented Programming in Python [12 Hrs]
Classes and Objects: Introduction, classes and objects, class method and self argument, in it ()
method, class and object variables, del () method, other special methods, public and private data
members, private methods, calling a class method from another class method, built-in class
attributes, garbage collection, ,class and static methods.
Inheritance: Introduction, inheriting classes in python, types of inheritance,
composition/containership/complex objects, abstract classes and interfaces, Meta class.
4. File Handling [8 Hrs]
File types, File input and output, File operations like open(), close(), read(),read line(),read lines
(),write(), write lines(), remove(), flush(), tell(), next(), rename()
Note: Development of mini project on the basis of the knowledge gained
Practical/Laboratory Content
1. Create a program that asks the user to enter their name and year of birth and print the age
2. Program to enter a number by the user and depending on whether the number is even or odd, print
out an appropriate message to the user.
3. Write a program to generate the Fibonacci series.
4. Write a recursive function to print the factorial for a given number.
5. Write a program that takes two lists and returns True if they have at least one common member.
6. Write a program to count the numbers of characters in the string and store them in a dictionary data
structure.
7. Find mean, median, mode for the given set of numbers in a list
8. Write a program to concatenate two dictionaries to create a new one.
9. Write a Python program to append text to a file and display the text
10. Write a program to create a simple class and print the message “ Welcome to Python” and print the
address of instance of the class
11. Write a program to pass an object as parameter to a method
12. Write a program to inherit the attributes of the parent class to a child class
15