#[first name, Last name, grade, seat #]
students = [["Shreyas", "Adhikari", 12, 1], ["Athena", "Albright", 12, 2], ["Youness", "Bounkiba", 12, 3],
["Youwei", "Cheng", 11, 4], ["Benjamin", "Frisch", 10, 5], ["Lauren", "Harris", 10, 6],
["Lily", "Hwang", 10, 7], ["Ethan", "Jong", 12, 8], ["Claire", "Kent", 10, 9],
["Rachit", "Keyal", 12, 10], ["Ananya", "Kovvali", 10, 11], ["Jeffrey", "Marquis", 11, 12],
["Nick", "Mandelli", 10, 13], ["Alexis", "Mills", 12, 14], ["Lyndsey", "Pan", 10, 15],
["Aryan", "Patel", 12, 16], ["Richard", "Patty", 12, 17], ["Johnne", "Plastina", 12, 18],
["Purva", "Ramani", 9, 19], ["Angel", "Rivera Murillo", 11, 20], ["Gian", "Trajano", 11, 21],
["Maia", "Tsalik", 12, 22], ["Aneesh", "Tuggudem", 10, 23], ["Brian", "Yoon", 10, 24],
["Xochiel", "Fernandez", 10, 25], ["Mann", "Patel", 12, 26], ["Akshitha", "Srinivasan", 10, 27]]
#separating sophomores
sophomores = []
for student in students:
if student[2] == 10:
full_name = student[0] + " " + student[1]
sophomores.append(full_name)
#finding avg length
from math import trunc
name_length_avg = 0
letters = 0
student_num = 0
for student in sophomores:
letters += len(student)
student_num += 1
name_length_avg = trunc(letters/student_num)
#sorting upperclassmen
avg_upperclass = []
other_upperclass = []
for student in students:
if student[2] == 9:
continue
elif student[2] == 10:
continue
else:
full_name = student[0] + " " + student[1]
if len(full_name) == name_length_avg:
avg_upperclass.append(full_name)
else:
other_upperclass.append(full_name)
#printing sophomores
print("SOPHOMORES:\n")
for student in sophomores:
space = student.find(" ")
length = len(student)
first_name = student[0:space]
last_name = student[space:length]
print("%-8s%s" %(first_name, last_name))
#printing avg upperclass
print("\nAVERAGE UPPERCLASS:\n")
for student in avg_upperclass:
space = student.find(" ")
length = len(student)
first_name = student[0:space]
last_name = student[space:length]
print("%-8s%s" %(first_name, last_name))
#printinh other upperclass
print("\nOTHER UPPERCLASS:\n")
for student in other_upperclass:
space = student.find(" ")
length = len(student)
first_name = student[0:space]
last_name = student[space:length]
print("%-8s%s" %(first_name, last_name))