# Filters out duplicate houses using loop students = [ {"name": "Hermione", "house": "Gryffindor"}, {"name": "Harry", "house": "Gryffindor"}, {"name": "Ron", "house": "Gryffindor"}, {"name": "Draco", "house": "Slytherin"}, {"name": "Padma", "house": "Ravenclaw"}, ] houses = [] for student in students: if student["house"] not in houses: houses.append(student["house"]) for house in sorted(houses): print(house)