for each instructor ID foundClass = False for each class in teaches if class.ID = instructor.ID and semester = 'fall' and year = 2009 foundClass = True if not foundClass, instructor.delete(ID)