Untitled

mail@pastecode.io avatar
unknown
python
a month ago
619 B
2
Indexable
Never
def highestAtt(N, Name, M, Attendance):
    max_attendance = 0
    result = []

    # Calculate attendance for each student
    for j in range(N):
        if M == 1:
            total_present = Attendance[0][j]
        else:
            total_present = sum(Attendance[i][j] for i in range(M))
        
        if total_present > max_attendance:
            max_attendance = total_present
            result = [Name[j]]
        elif total_present == max_attendance:
            result.append(Name[j])
    
    if len(result) > 1:
        return "Prize shared between Multiple Students"
    else:
        return result[0]
Leave a Comment