t
PART-B
4.Write a python program to create Simple Class and Object
#--------------------------------------
class Student:
def __init__(self, name, roll_no, course):
self.name = name # Attribute
self.roll_no = roll_no # Attribute
self.course = course # Attribute
def display_info(self):
print(f"Student: {self.name} | Roll No: {self.roll_no} | Course: {self.course}")
student1 = Student("Aryan", 101, "Computer Science")
student2 = Student("Isha", 102, "Data Science")
print("--- Student Records ---")
student1.display_info()
student2.display_info()
print(f"\nDirect Access: {student1.name} is enrolled in {student1.course}.")