0% found this document useful (0 votes)
2 views2 pages

Experiment 7

The document outlines an experiment focused on understanding classes and objects in Python through Object-Oriented Programming (OOP). It explains the concepts of classes as blueprints for creating objects, the syntax for defining classes, and provides an example with a Student class. Additionally, it highlights key concepts such as encapsulation, reusability, and abstraction, along with potential industrial applications.

Uploaded by

paraspatil029
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Experiment 7

The document outlines an experiment focused on understanding classes and objects in Python through Object-Oriented Programming (OOP). It explains the concepts of classes as blueprints for creating objects, the syntax for defining classes, and provides an example with a Student class. Additionally, it highlights key concepts such as encapsulation, reusability, and abstraction, along with potential industrial applications.

Uploaded by

paraspatil029
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Experiment 7

Class and objects in Python


Aim: To write a Python program To Understand the Class and objects.

Objectives: Implementing a Python program To understand the concept of Class and Objects.
Software Required:
1. Windows or Linux Desktop OS
2. Python 3.6 or higher
3. Google Colab

Theory:
Introduction to Object-Oriented Programming (OOP)

Object-Oriented Programming (OOP) is a programming paradigm based on the concept of "objects, "
which contain data (attributes) and functions (methods) that operate on that data.

What is a Class?
A class is a blueprint for creating objects. It defines a set of attributes (variables) and methods
(functions) that describe the behavior of the object.

Syntax of a Class :
class ClassName:
def __init__(self, param1, param2):
self.attribute1 = param1
self.attribute2 = param2

def method_name(self):
print("This is a method")

What is an Object?
An object is an instance of a class. It contains actual values stored in attributes and can access the
methods defined in the class.

Creating an Object :
obj = ClassName(value1, value2)

ITL404 : Python Lab


Example: Student Class in Python
class Student:
def __init__(self, name, age, course):
self.name = name
self.age = age
self.course = course

def display_info(self):
print(f"Student Name: {self.name}")
print(f"Age: {self.age}")
print(f"Course: {self.course}")

# Creating objects
student1 = Student("Amit", 21, "Information Technology")
student1.display_info()

Key Concepts

1. Encapsulation: Wrapping data and methods into a single unit (class).


2. Reusability: Once a class is created, multiple objects can be instantiated from it.
3. Abstraction: Hiding internal implementation and exposing only necessary details.

Result Analysis:

Conclusion:

Industrial Applications:- Web Development, Banking and Finance Applications, Healthcare


Systems etc..

ITL404 : Python Lab

You might also like