1. Nadar Saraswati college of arts and Science
Department of Computer Science
python
Classesandobjects
presented by
k.diana devi
M.sc( cs)
2. What is python
Introduction
Python class
Define python class
Example
Python objects
Example
3. What is python?
python is a dynamic,interpreted( byte code-
compiled) language.
There are no type declaration of variable,
parameters, functions or methods in source
code.
4. Introduction
An object is simply a collection of data( variable)and methods (
functions). Similarly a class is a
Blue print for that objects
5. Python classes
A class is considered as a blue print of objects.we can think of
the classes as a sketch ( prototype) of a house.
It contains all the details about the floors, doors, windows etc.
Based on these description we build the house .House is the
object.
6. Define python class
We use the class keyword to create a class in python
For ex:
Class class Name:
#class definition
Hence we have created a class named Class Name.
8. Python objects
An objects is called instance of class .For ex:Suppose
Bike is a class then we can create object like bike 1, bike 2,etc
from the class
Here’s the syntax to create an object
Object Name= Class Name()