0% found this document useful (0 votes)
10 views1 page

Python Class and Function Example

The document is a Python lab report by Deepak Prakash Deore, focusing on understanding classes, objects, and functions in Python. It includes a class definition for 'Student' with methods to display information and a function to calculate the square of a number. The output demonstrates the functionality of the class and the square function.

Uploaded by

wafflerick69
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)
10 views1 page

Python Class and Function Example

The document is a Python lab report by Deepak Prakash Deore, focusing on understanding classes, objects, and functions in Python. It includes a class definition for 'Student' with methods to display information and a function to calculate the square of a number. The output demonstrates the functionality of the class and the square function.

Uploaded by

wafflerick69
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

Name : Deepak Prakash Deore Sign :-

Roll no :- 57 Date :- / / 2025


Branch :- Second Year [Link] (IT)
Sub:- Python Lab
Remark :-
Exp. No:- 01

Title : Write a python program to understand class , object and functions.

# Defining a class class


Student:
def _init_(self, name, age):
[Link] = name
[Link] = age

def display_info(self):

print(f"Student Name: {[Link]}, Age: {[Link]}")

# Creating an object
student1

Student("John", 20)
student1.display_info()

# Defining a function def


square(num):

return num * num


print("Square of 5:",square(5))

Output:

Student Name: John, Age: 20


Square of 5: 25

You might also like