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

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

PPTX
Python_Unit_2 OOPS.pptx
ChhaviCoachingCenter
 
PPTX
Unit – V Object Oriented Programming in Python.pptx
YugandharaNalavade
 
PPTX
slides11-objects_and_classes in python.pptx
debasisdas225831
 
PPTX
Object Oriented Programming Concepts Using C++
Mtnc BCA DEPARTMENT
 
PPTX
مقدمة بايثون .pptx
AlmutasemBillahAlwas
 
PDF
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
PPTX
OOP Concepts Python with code refrences.pptx
SofiMusic
 
PPTX
Class and Objects in python programming.pptx
Rajtherock
 
PPT
07slide.ppt
NuurAxmed2
 
PPTX
Regex,functions, inheritance,class, attribute,overloding
sangumanikesh
 
PPTX
UNIT 3 PY.pptx - OOPS CONCEPTS IN PYTHON
drkangurajuphd
 
PPTX
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
PPTX
python.pptx
Dhanushrajucm
 
PPTX
IPP-M5-C1-Classes _ Objects python -S2.pptx
DhavalaShreeBJain
 
PPTX
Object Oriented Programming.pptx
SAICHARANREDDYN
 
PPTX
object oriented porgramming using Java programming
afsheenfaiq2
 
PPTX
Chapter 04 object oriented programming
Praveen M Jigajinni
 
PPTX
Introduction to OOP_Python_Lecture1.pptx
cpics
 
Python_Unit_2 OOPS.pptx
ChhaviCoachingCenter
 
Unit – V Object Oriented Programming in Python.pptx
YugandharaNalavade
 
slides11-objects_and_classes in python.pptx
debasisdas225831
 
Object Oriented Programming Concepts Using C++
Mtnc BCA DEPARTMENT
 
مقدمة بايثون .pptx
AlmutasemBillahAlwas
 
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
OOP Concepts Python with code refrences.pptx
SofiMusic
 
Class and Objects in python programming.pptx
Rajtherock
 
07slide.ppt
NuurAxmed2
 
Regex,functions, inheritance,class, attribute,overloding
sangumanikesh
 
UNIT 3 PY.pptx - OOPS CONCEPTS IN PYTHON
drkangurajuphd
 
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
python.pptx
Dhanushrajucm
 
IPP-M5-C1-Classes _ Objects python -S2.pptx
DhavalaShreeBJain
 
Object Oriented Programming.pptx
SAICHARANREDDYN
 
object oriented porgramming using Java programming
afsheenfaiq2
 
Chapter 04 object oriented programming
Praveen M Jigajinni
 
Introduction to OOP_Python_Lecture1.pptx
cpics
 

More from Lipika Sharma (11)

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

Recently uploaded (20)

PDF
GOOGLE ADS (1).pdf THE ULTIMATE GUIDE TO
kushalkeshwanisou
 
PPTX
Cultural Diversity Presentation.pptx
Shwong11
 
PDF
Predicting Titanic Survival Presentation
praxyfarhana
 
PPT
Reliability Monitoring of Aircrfat commerce
Rizk2
 
PPTX
big data eco system fundamentals of data science
arivukarasi
 
PDF
Kafka Use Cases Real-World Applications
Accentfuture
 
PPTX
Data Analytics using sparkabcdefghi.pptx
KarkuzhaliS3
 
PDF
Exploiting the Low Volatility Anomaly: A Low Beta Model Portfolio for Risk-Ad...
Bradley Norbom, CFA
 
PDF
CT-2-Ancient ancient accept-Criticism.pdf
DepartmentofEnglishC1
 
PPTX
microservices-with-container-apps-dapr.pptx
vjay22
 
PDF
IT GOVERNANCE 4-2 - Information System Security (1).pdf
mdirfanuddin1322
 
PPTX
MENU-DRIVEN PROGRAM ON ARUNACHAL PRADESH.pptx
manvi200807
 
PPTX
Discrete Logarithm Problem in Cryptography (1).pptx
meshablinx38
 
PPTX
Krezentios memories in college data.pptx
notknown9
 
PDF
TCU EVALUATION FACULTY TCU Taguig City 1st Semester 2017-2018
MELJUN CORTES
 
PDF
Unlocking Insights: Introducing i-Metrics Asia-Pacific Corporation and Strate...
Janette Toral
 
DOCX
🧩 1. Solvent R-WPS Office work scientific
NohaSalah45
 
PPTX
RESEARCH-FINAL-GROUP-3, about the final .pptx
gwapokoha1
 
DOCX
ACCOMPLISHMENT AS OF MAY 15 RCT ACCOMPLISHMENT AS OF MAY 15 RCT ACCOMPLISHMEN...
JoemarAgbayani1
 
PDF
A Web Repository System for Data Mining in Drug Discovery
IJDKP
 
GOOGLE ADS (1).pdf THE ULTIMATE GUIDE TO
kushalkeshwanisou
 
Cultural Diversity Presentation.pptx
Shwong11
 
Predicting Titanic Survival Presentation
praxyfarhana
 
Reliability Monitoring of Aircrfat commerce
Rizk2
 
big data eco system fundamentals of data science
arivukarasi
 
Kafka Use Cases Real-World Applications
Accentfuture
 
Data Analytics using sparkabcdefghi.pptx
KarkuzhaliS3
 
Exploiting the Low Volatility Anomaly: A Low Beta Model Portfolio for Risk-Ad...
Bradley Norbom, CFA
 
CT-2-Ancient ancient accept-Criticism.pdf
DepartmentofEnglishC1
 
microservices-with-container-apps-dapr.pptx
vjay22
 
IT GOVERNANCE 4-2 - Information System Security (1).pdf
mdirfanuddin1322
 
MENU-DRIVEN PROGRAM ON ARUNACHAL PRADESH.pptx
manvi200807
 
Discrete Logarithm Problem in Cryptography (1).pptx
meshablinx38
 
Krezentios memories in college data.pptx
notknown9
 
TCU EVALUATION FACULTY TCU Taguig City 1st Semester 2017-2018
MELJUN CORTES
 
Unlocking Insights: Introducing i-Metrics Asia-Pacific Corporation and Strate...
Janette Toral
 
🧩 1. Solvent R-WPS Office work scientific
NohaSalah45
 
RESEARCH-FINAL-GROUP-3, about the final .pptx
gwapokoha1
 
ACCOMPLISHMENT AS OF MAY 15 RCT ACCOMPLISHMENT AS OF MAY 15 RCT ACCOMPLISHMEN...
JoemarAgbayani1
 
A Web Repository System for Data Mining in Drug Discovery
IJDKP
 
Ad

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?