# Allison Obourn
# CSC 110, Spring 2018
# Lecture 35

# reads in student section data from a file and outputs
# all sections of the class or individual sections

def main():
    students = open('sections2.txt').readlines()
    sections = {}
    for i in range(len(students)):
        line = students[i].split()
        section = line[0]
        sections[section] = set()
        for j in range(1, len(line)):
            sections[section].add(line[j])
    print(sections)
    get_section(sections, '1B')

# takes a dictionary of section name to set of students
# as a parameter and outputs all students in the class
def get_classlist(sections):
    for secion in sections:
        get_section(sections, section)

# takes a dictionary of section names to set of students
# and a name of a section and outputs all students
# in that section one per line
def get_section(sections, name):
    name_set = sections[name]
    for name in name_set:
        print(name)


main()
