SlideShare a Scribd company logo
Introduction to Python for Data
Science
Replay
Module 2 :Overview of Data Science Tools and Technologies
• Introduction to popular data science tools such as R
• Introduction to popular data science tools such as SQL
• Overview of machine learning algorithms and their applications
Session 7:Python programming
Concepts
Python Advance Topics
• Functions
• Classes
• Objects
• Methods
• Constructor
• OOPS
Inheritance
Encapsulation
Polymorphism
Abstraction
Functions with no arguments
• Python Functions is a block of statements that return the
specific task. The idea is to put some commonly or repeatedly
done tasks together and make a function so that instead of
writing the same code again and again for different inputs, we
can do the function calls to reuse code contained in it over and
over again.
Use function arguments in Python
• Information can be passed into
functions as arguments. Arguments
are specified after the function name,
inside the parentheses. You can add as
many arguments as you want, just
separate them with a comma.
• A parameter is the variable listed inside
the parentheses in the function
definition.
• An argument is the value that are sent
to the function when it is called.
The terms parameter and argument can be used for the same thing: information that are passed into a
function.
OOPS
Object-Oriented Programming (OOPs) is a programming
paradigm that uses objects and classes in programming.
OOPs, concepts in python, aim to implement real-world
entities like inheritance, polymorphisms, encapsulation,
etc., in the programming.
The concept of OOP in Python focuses on building
efficient and reusable code. This is also known as DRY
(don't repeat yourself).
How to Create a Class in Python
• A Class is like an object
constructor, or a "blueprint"
for creating objects.
• A class is created using the
keyword class.
• Attributes refer to variables
that belong to a class.
• These attributes are always
public, and you can access
them using a dot (.).
class ClassName:
#statement_suite
# Declare an object of a class
object_name = ClassName(argume
nts)
Method and Constructor in
Python
Methods are essential components of
Python object-oriented programming
(OOP) as they encapsulate the functionality
associated with the objects.
Method
Class Games:
X=100
Def value(self):
print(self.X)
Obj=Games()
Obj.value()
Constructors are generally used for instantiating an
object. The task of constructors is to initialize(assign
values) to the data members of the class when an
object of the class is created. In Python the __init__()
method is called the constructor and is always
called when an object is created.
Constructor
class Games:
# default constructor
def __init__(self):
print(“welcome”)
# creating object of the class
obj = Games()
Inheritance
• Inheritance is the capability of one class to derive or inherit the
properties from another class. The class that derives properties is
called the derived class or child class and the class from which the
properties are being derived is called the base class or parent class.
Encapsulation
Encapsulation is one of the fundamental concepts in object-
oriented programming (OOP). It describes the idea of wrapping
data and the methods that work on data within one unit. This puts
restrictions on accessing variables and methods directly and can
prevent the accidental modification of data. To prevent accidental
change, an object’s variable can only be changed by an object’s
method. Those types of variables are known as private variables.
A class is an example of encapsulation as it encapsulates all the
data that is member functions, variables, etc.
Polymorphism
• Poly' means multiple and 'morph' means forms. So, polymorphism altogether
means something that has multiple forms. Or, 'some thing' that can have
multiple behaviours depending upon the situation.
• Polymorphism in OOPS refers to the functions having the same names but
carrying different functionalities. Or, having the same function name, but
different function signature(parameters passed to the function).
Abstraction
• Abstraction just shows us the functionalities anything holds, hiding all the
implementations or inner details.
• The main goal of Abstraction is to hide background details or any unnecessary
implementation about the data so that users only see the required information. It
helps in handling the complexity of the codes.
• Abstraction can be achieved by using abstract classes
• A class that consists of one or more abstract methods is called the "abstract class".
• Abstract class can be inherited by any subclass. The subclasses that inherit the
abstract classes provide the implementations for their abstract methods.
• Abstract classes can act like blueprint to other classes, which are useful when we
are designing large functions. And the subclass which inherits them can refer to the
abstract methods for implementing the features.
Q N A
Q What are access specifiers? What is
their significance in OOPs?
Q How is an abstract class different from an
interface?
Q How much memory does a class
occupy?

More Related Content

PPTX
Python-Classes.pptx
PPTX
Introduction to oop
PPTX
PPTX
Object Oriented Programming.pptx
PPTX
Class and Objects in python programming.pptx
PPTX
PYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptx
DOC
My c++
PPTX
AI - PYTHON PROGRAMMING BASICS II.pptx
Python-Classes.pptx
Introduction to oop
Object Oriented Programming.pptx
Class and Objects in python programming.pptx
PYTHON-COURSE-PROGRAMMING-UNIT-IV--.pptx
My c++
AI - PYTHON PROGRAMMING BASICS II.pptx

Similar to Python programming Concepts (Functions, classes and Oops concept (20)

PPTX
PYTHON OBJECT-ORIENTED PROGRAMMING.pptx
PPTX
object oriented porgramming using Java programming
PPTX
object oriented porgramming using Java programming
PPTX
Object Oriented Programming in Python.pptx
PPTX
basic concepts of object oriented in python
PPTX
Oopsinphp
PPTX
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
PPTX
OOPS 46 slide Python concepts .pptx
PPTX
Principles of OOPs.pptx
PPTX
Introduction to Object Oriented Programming in Python.pptx
PPTX
Chapter 05 classes and objects
PPT
UNIT-IV WT web technology for 1st year cs
PPTX
ECAP444 - OBJECT ORIENTED PROGRAMMING USING C++.pptx
PPTX
Lecture-10_PHP-OOP.pptx
PPTX
Php oop (1)
PPTX
Object Oriented Programming Class and Objects
PPTX
Object oriented programming in python
PPTX
Lecture 5.pptx
PPTX
oogshsvshsbhshhshvsvshsvsvhshshjshshhsvgps.pptx
PPTX
PHP OOP Lecture - 01.pptx
PYTHON OBJECT-ORIENTED PROGRAMMING.pptx
object oriented porgramming using Java programming
object oriented porgramming using Java programming
Object Oriented Programming in Python.pptx
basic concepts of object oriented in python
Oopsinphp
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
OOPS 46 slide Python concepts .pptx
Principles of OOPs.pptx
Introduction to Object Oriented Programming in Python.pptx
Chapter 05 classes and objects
UNIT-IV WT web technology for 1st year cs
ECAP444 - OBJECT ORIENTED PROGRAMMING USING C++.pptx
Lecture-10_PHP-OOP.pptx
Php oop (1)
Object Oriented Programming Class and Objects
Object oriented programming in python
Lecture 5.pptx
oogshsvshsbhshhshvsvshsvsvhshshjshshhsvgps.pptx
PHP OOP Lecture - 01.pptx
Ad

More from Lipika Sharma (11)

PPTX
Importing data from various sources (CSV, Excel, SQL)
PPTX
Basic data manipulation with pandas pandas
PPTX
Introduction to Jupyter Notebooks and Anaconda
PPTX
Introduction to data visualization tools like Tableau and Power BI and Excel
PPTX
Overview of machine learning algorithms and their applications
PPTX
Introduction to popular data science tools such as R, and SQL
PPTX
Introduction to python and its basics (variables, data types, control structures
PPTX
Importance of data science in modern business environments
PPTX
Introduction to Data Science and its Scope
PPTX
NLP PPT.pptx
PPTX
Current banking scenario and Job opportunities in banking
Importing data from various sources (CSV, Excel, SQL)
Basic data manipulation with pandas pandas
Introduction to Jupyter Notebooks and Anaconda
Introduction to data visualization tools like Tableau and Power BI and Excel
Overview of machine learning algorithms and their applications
Introduction to popular data science tools such as R, and SQL
Introduction to python and its basics (variables, data types, control structures
Importance of data science in modern business environments
Introduction to Data Science and its Scope
NLP PPT.pptx
Current banking scenario and Job opportunities in banking
Ad

Recently uploaded (20)

PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PPTX
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PPTX
Moving the Public Sector (Government) to a Digital Adoption
PDF
Mega Projects Data Mega Projects Data
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
PDF
Introduction to Business Data Analytics.
PPT
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
PPTX
climate analysis of Dhaka ,Banglades.pptx
PPTX
Supervised vs unsupervised machine learning algorithms
PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
PPTX
1_Introduction to advance data techniques.pptx
PPT
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
Computer network topology notes for revision
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
Galatica Smart Energy Infrastructure Startup Pitch Deck
Data_Analytics_and_PowerBI_Presentation.pptx
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
oil_refinery_comprehensive_20250804084928 (1).pptx
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Moving the Public Sector (Government) to a Digital Adoption
Mega Projects Data Mega Projects Data
Miokarditis (Inflamasi pada Otot Jantung)
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
Introduction to Business Data Analytics.
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
climate analysis of Dhaka ,Banglades.pptx
Supervised vs unsupervised machine learning algorithms
IBA_Chapter_11_Slides_Final_Accessible.pptx
1_Introduction to advance data techniques.pptx
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
Computer network topology notes for revision
The THESIS FINAL-DEFENSE-PRESENTATION.pptx

Python programming Concepts (Functions, classes and Oops concept

  • 1. Introduction to Python for Data Science
  • 2. Replay Module 2 :Overview of Data Science Tools and Technologies • Introduction to popular data science tools such as R • Introduction to popular data science tools such as SQL • Overview of machine learning algorithms and their applications
  • 3. Session 7:Python programming Concepts Python Advance Topics • Functions • Classes • Objects • Methods • Constructor • OOPS Inheritance Encapsulation Polymorphism Abstraction
  • 4. Functions with no arguments • Python Functions is a block of statements that return the specific task. The idea is to put some commonly or repeatedly done tasks together and make a function so that instead of writing the same code again and again for different inputs, we can do the function calls to reuse code contained in it over and over again.
  • 5. Use function arguments in Python • Information can be passed into functions as arguments. Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, just separate them with a comma. • A parameter is the variable listed inside the parentheses in the function definition. • An argument is the value that are sent to the function when it is called. The terms parameter and argument can be used for the same thing: information that are passed into a function.
  • 6. OOPS Object-Oriented Programming (OOPs) is a programming paradigm that uses objects and classes in programming. OOPs, concepts in python, aim to implement real-world entities like inheritance, polymorphisms, encapsulation, etc., in the programming. The concept of OOP in Python focuses on building efficient and reusable code. This is also known as DRY (don't repeat yourself).
  • 7. How to Create a Class in Python • A Class is like an object constructor, or a "blueprint" for creating objects. • A class is created using the keyword class. • Attributes refer to variables that belong to a class. • These attributes are always public, and you can access them using a dot (.). class ClassName: #statement_suite # Declare an object of a class object_name = ClassName(argume nts)
  • 8. Method and Constructor in Python Methods are essential components of Python object-oriented programming (OOP) as they encapsulate the functionality associated with the objects. Method Class Games: X=100 Def value(self): print(self.X) Obj=Games() Obj.value() Constructors are generally used for instantiating an object. The task of constructors is to initialize(assign values) to the data members of the class when an object of the class is created. In Python the __init__() method is called the constructor and is always called when an object is created. Constructor class Games: # default constructor def __init__(self): print(“welcome”) # creating object of the class obj = Games()
  • 9. Inheritance • Inheritance is the capability of one class to derive or inherit the properties from another class. The class that derives properties is called the derived class or child class and the class from which the properties are being derived is called the base class or parent class.
  • 10. Encapsulation Encapsulation is one of the fundamental concepts in object- oriented programming (OOP). It describes the idea of wrapping data and the methods that work on data within one unit. This puts restrictions on accessing variables and methods directly and can prevent the accidental modification of data. To prevent accidental change, an object’s variable can only be changed by an object’s method. Those types of variables are known as private variables. A class is an example of encapsulation as it encapsulates all the data that is member functions, variables, etc.
  • 11. Polymorphism • Poly' means multiple and 'morph' means forms. So, polymorphism altogether means something that has multiple forms. Or, 'some thing' that can have multiple behaviours depending upon the situation. • Polymorphism in OOPS refers to the functions having the same names but carrying different functionalities. Or, having the same function name, but different function signature(parameters passed to the function).
  • 12. Abstraction • Abstraction just shows us the functionalities anything holds, hiding all the implementations or inner details. • The main goal of Abstraction is to hide background details or any unnecessary implementation about the data so that users only see the required information. It helps in handling the complexity of the codes. • Abstraction can be achieved by using abstract classes • A class that consists of one or more abstract methods is called the "abstract class". • Abstract class can be inherited by any subclass. The subclasses that inherit the abstract classes provide the implementations for their abstract methods. • Abstract classes can act like blueprint to other classes, which are useful when we are designing large functions. And the subclass which inherits them can refer to the abstract methods for implementing the features.
  • 13. Q N A
  • 14. Q What are access specifiers? What is their significance in OOPs?
  • 15. Q How is an abstract class different from an interface?
  • 16. Q How much memory does a class occupy?