PPS - Notes - Unit 5
PPS - Notes - Unit 5
AY 2022-23
Prepared By
Prof. S.B.Patil
Vision and Mission of Institute
VISION
“We are committed to produce not only good engineers but good human beings, also.”
MISSION
• We believe in and work for the holistic development of students and teachers.
• We strive to achieve this by imbibing a unique value system, transparent work culture,
excellent academic and physical environment conducive to learning, creativity and
technology transfer.
VISION
The department of Engineering Sciences is committed to support the core engineering programs
with fundamental knowledge and skills with acumen to be leaders amongst the generation of
engineers.
MISSION
The department of Engineering Sciences strives to incorporate the best pedagogical methods to
deliver basic sciences to engineering students and to guide them to be proactive learners, deep
thinkers and responsible citizens in the early stages of their engineering education.
To foster students of first year engineering for the respective programs of engineering
through expert lectures, seminars & mini projects.
To implement activity plan for overall development of students.
To develop laboratories for meaningful implementation of curriculum and then for
research.
To apply project and problem based leaning approach for first year engineering program
to create a bridge to support to core departments for guiding projects of students.
To cultivate research in the field of Engineering Sciences for the benefit of society.
POs are statements that describe what students are expected to know and be able to do upon
graduating from the program. These relate to the skills, knowledge, analytical ability attitude and
behavior that students acquire through the program.
i) Problem Analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences and engineering sciences.
ii) Design/Development of Solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
1. Get solid foundation in basic sciences along with engineering fundamentals for a
successful professional career.
2. Able to co-relate engineering issues to broad social context.
Credit: 04
End-Sem: 70 Marks
Course Objectives: Prime objective is to give students a basic introduction to programming and
problem solving with computer language Python. And to introduce students not merely to the
coding of computer programs, but to computational thinking, the methodology of computer
programming, and the principles of good program design including modularity and
encapsulation.
1) To understand problem solving, problem solving aspects, programming and to know about
various program design tools.
2) To learn problem solving with computers
3) To learn basics, features and future of Python programming.
4) To acquaint with data types, input output statements, decision making, looping and functions
in Python
5) To learn features of Object Oriented Programming using Python
6) To acquaint with the use and benefits of files handling in Python
Course Outcomes:
CO2. Choose most appropriate programming constructs and features to solve the problems in
diversified domains.
CO3. Exhibit the programming skills for the problems those require the writing of well-
documented programs including use of the logical constructs of language, Python.
CO4. Demonstrate significant experience with the Python program development environment
Unit Objectives :
On completion the students will be able to :
1. Understand the different programming Paradigms.
2. Understand the various features of OOP.
3. Get standard Classes and Objects.
Unit outcomes:
Students are able to understand features of OOP:
1. Understand use of Classes, Objects, Methods and Inheritance, Polymorphism
using Pyhton program.
2. Exhibit the programming skills for the problems those require to use Classes and
Objects using Python program.
Start to apply various skills in problem solving using OOP features.
Books :
1. Reema Thareja, “Python Programming Using Problem Solving Approach”,
Oxford University Press
1. Monolithic programming
• Here complete program is written as a sequence.
• There are no modules or functions used.
• Example: Assembly Language and BASIC.
Advantage :
• It is simplest way of programming.
Disadvantage :
• Its problem is there can be lot of repetition of code when same
operation has to be done many times.
• The global data can be accessed and modified from any part of
the program, thereby, posing a serious threat to its integrity.
2. Procedural programming
• Here program is divided in procedures or functions.
• Function is a small unit of programming logic.
Advantages :
• Same function can be used multiple times in one program
whenever the operation is needed.
Prof. S. B. Patil, Mechanical Engineering Dept, SIT Lonavala. 8
• It reduces redundancy in program.
• It makes program readable.
Disadvantages
• Data can be modified by any procedure.
• Data is not protected properly.
• It may include ‘goto’ like statements which makes program un-
structured and poor in readability.
3. Structured programming (Paradigm)
• Here program is written in a structured format compulsorily.
• Now most of the procedural programming languages support
structured programming paradigm.
• Structured programming, also referred to as modular
programming.
• The primary focus is on functions (Modules).
• The technique of hierarchical decomposition has been used to
specify the tasks to be completed for solving a problem.
• Structured programming, organizing instructions into groups
known as functions.
• Each function may have its own local data.
Advantages
• It is readable program.
• It is easy to find errors or especially logical errors.
Example 2:
Output:
id = 10;
name = “Shital"
emp = Employee()
emp.display()
Output:
ID: 10
Name: Shital
var=10
def display(self):
obj=ABC()
print(obj.var)
obj.display()
Output:
10
In Class Method…..
Example :
10. Encapsulation
• As discussed in definition of class, OOP allows data
encapsulation.
• Encapsulation is a process of wrapping of data and
methods in a single unit.
• Combining of state and behavior in a single container is
known as encapsulation.
• Here data and functions are put together in a class.
• Users are allowed to execute only a restricted set of
operations (class methods) on the data members of the
class.
Self object
• ‘self’ is an important keyword in python.
• ‘self’ is reference to current object calling method.
• ‘self’ reference or object gives access to all values stored
in an object.
• ‘self’ can be used ONLY within an instance method within
a class.
• ‘self’ is also used as first default parameter to every
function in a class.
Class variables (static variables)
• Class variable or Static variables are variables which are
created once for a class.
• Such variables are common to all objects of a class.
• In python class variables are declared outside any function
in a class.
• Class variables are accessed using name of the class.
• Class variables do not require object of class to access
them.
Prof. S. B. Patil, Mechanical Engineering Dept, SIT Lonavala. 28
• ALL class variables are PUBLIC.
• Accessing, modification and deletion of class variables is
same as instance variables (non-static) variables, as
discussed in next part.
• Only difference in accessing, modification and deletion is
CLASS_NAME has to be used before class variable and in
instance variable self is used.
Example:
EXAMPLES
A. Important points:
1. Programming Paradigm
2. Features of Object oriented programming- classes, objects, methods and message
passing,
3. inheritance, polymorphism,
4. containership, reusability, delegation,
5. data abstraction and encapsulation,
6. class method and self object
7. class variables and object variables
8. public and private members
Lecture 1
1 Write about monolithic programming 5
16 Write a python program to create class car with two attributes name and 6
cost. Create two objects and display information.
18 Write a python program that demonstrate the use of class, object and 6
method.
Lecture 3
20 Define Terms 1) Polymorphism 2) Inheritance 6
Lecture 4
25 Explain the terms. 1. Inheritance 2. Data abstraction 3. Encapsulation 4. 5
Lecture 5
32 Explain class methods and self object with examples. 5
35 Explain the concept of class methods and self object with suitable example. 6
Lecture 6
39 What is class method? Give proper syntax for explanation 5
40 Differentiate between class variable and instance variable or what are the 6
types of variables in class.
44 Explain the concept of class variable and object variable with suitable 5
Lecture 7
45 Explain the concept of public and private members using proper python 6
program.
Lecture 8
49 Explain/Differentiate between public and private variables? 6
51 write a python program with class employee that keeps a track of the numbr 6
of employees in an organization and also stores their name, designation and
salary details