EX6python
EX6python
DATE: 07/04/2025
AIM:
To write a Python program to handle a structured array containing student details like
Name, Registration Number, and marks in 5 subjects. Implement aggregation
functions to:
1. Find the total and average marks of each student.
2. Identify the maximum and minimum marks in each subject.
3. Find the class topper.
4. Calculate the pass percentage for each subject.
5. Calculate the class pass percentage.
ALGORITHM:
Step 1: Define the student data structure using NumPy structured array with fields
for Name, Reg_no, and marks in 5 subjects.
Step 2: Initialize the sample data for students with their details and marks in each
subject.
Step 3: Convert the sample data into a structured NumPy array.
Step 4: Initialize an empty list total_marks to store each student's tmotal marks.
Step 5: Loop through each student, extract marks, calculate total and average
marks, append total marks to total_marks, and print the results.
Step 6: Convert total_marks list to a NumPy array.
Step 7: Calculate the class pass percentage based on the number of students who
passed all subjects.
Step 8: Calculate the maximum and minimum marks for each subject and the pass
percentage for each subject.
Step 9: Find the class topper by identifying the student with the highest total marks.
Step 10: End.
data = [
('Ananya', 'R123', 80, 90, 85, 75, 88),
('Aruna', 'R124', 70, 80, 78, 85, 72),
('Akshara', 'R125', 95, 85, 90, 92, 91),
('Roshini', 'R126', 30, 35, 40, 41, 68)
]
RESULT:
Thus, the module to handle structured arrays and implement aggregate
functions has been successfully implemented.