students = [
    {'name': 'Swathi Donda', 'major': 'Mechanical Engineering', 'GPA': 3.9, 'level': 'junior', 'is_resident': True},
    {'name': 'Penny Rice', 'major': 'Art', 'GPA': 3.2, 'level': 'freshman', 'is_resident': True},
    {'name': 'Della Reese', 'major': 'Political Science', 'GPA': 4.0, 'level': 'senior', 'is_resident': False},
    {'name': 'Lin Ana', 'major': 'Computer Science', 'GPA': 3.4, 'level': 'senior', 'is_resident': True},
    {'name': 'Mark Casper', 'major': 'Art', 'GPA': 2.9, 'level': 'junior', 'is_resident': False}
]

print("\nStudent List:")
for student in students:
    print(student)

# You can also access specific students and their attributes directly by index and key
# Note that the list is zero-indexed, so the first student is at index 0, the second at index 1, and so on.
# For example, to access the 4th student (index 3) and print their name and major:
print("\nStudent #4:", students[3])
print("Student #4:", students[3]["name"], "is majoring in", students[3]["major"]+".")

print("\nStudents with GPA above 3.5:")
for student in students:
    if student["GPA"] > 3.5:
        print("-", student["name"], "has a GPA above 3.5.")

print("\nStudents majoring in Art:")
for student in students:
    if student["major"] == "Art":
        print("-", student["name"], "is an Art major.")


print("\nStudents by residency status:")
for student in students:
    if student["is_resident"]:
        print("-",student["name"], "is a resident.")
    else:
        print("-", student["name"], "is a commuter.")


# Create lists of majors for each college
engineering = ["Mechanical Engineering", "Civil Engineering", "Electrical and Computer Engineering"]
fine_arts = ["Art", "Music", "Dance", "Theatre"]
science_math = ["Math", "Computer Science", "Biology", "Chemistry", "Physics"]

print("\nStudents by college:")
for student in students:
    major = student["major"]

    if major in engineering:
        print("-", student["name"], "is in the College of Engineering.")
    
    elif major in fine_arts:
        print("-", student["name"], "is in the College of Fine Arts.")
    
    elif major in science_math:
        print("-", student["name"], "is in the College of Science and Math.")
    
    else:
        print("- The college for", student["name"], "is unknown.")