0% found this document useful (0 votes)
8 views

Code

The document defines a Student class with attributes for name, register number, CGPA, and arrear subjects. It includes a method to display student details and collects information for five students through user input. Finally, it displays the details of all collected student objects.

Uploaded by

nithishnithy2001
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)
8 views

Code

The document defines a Student class with attributes for name, register number, CGPA, and arrear subjects. It includes a method to display student details and collects information for five students through user input. Finally, it displays the details of all collected student objects.

Uploaded by

nithishnithy2001
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

class Student:

def _init_(self, name, register_no, cgpa, arrear_subject):

self.name = name

self.register_no = register_no

self.cgpa = cgpa

self.arrear_subject = arrear_subject

def display_details(self):

print(f"Name: {self.name}")

print(f"Register No: {self.register_no}")

print(f"CGPA: {self.cgpa}")

print(f"Arrear Subject: {self.arrear_subject}")

print("-" * 30)

# List to store student objects

students = []

# Collecting details for 5 students

for i in range(5):

print(f"Enter details for Student {i + 1}:")

name = input("Enter Name: ")

register_no = input("Enter Register No: ")

cgpa = float(input("Enter CGPA: "))

arrear_subject = input("Enter Arrear Subject (if any, else leave blank): ")

# Creating a student object and adding it to the list

student = Student(name, register_no, cgpa, arrear_subject)

students.append(student)

print() # Blank line for better readability


# Displaying the details of all students

print("Student Details:\n")

for student in students:

student.display_details()

You might also like