## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

# Task 4: Checked independently--will get back teacher with max count of classes!!

Please let me know what is up. I checked this independently and I consistently get the correct count of teachers as I vary the amount of classes per teachers in my dictionary.

teachers.py
```# The dictionary will look something like:
# {'Andrew Chalkley': ['jQuery Basics', 'Node.js Basics'],
#  'Kenneth Love': ['Python Basics', 'Python Collections']}
#
# Each key will be a Teacher and the value will be a list of courses.
#
# Your code goes below here.
def num_teachers(dict1):
list1 = (list(dict1.keys()))
return(len(list1))

def num_courses(dict1):

list2 = (list(dict1.values()))
flat_list = []
for sublist in list2:
for item in sublist:
flat_list.append(item)
return(len(flat_list))

def courses(dict1):

list2 = (list(dict1.values()))
flat_list = []
for sublist in list2:
for item in sublist:
flat_list.append(item)
return(flat_list)

def most_courses(dict1):

list4 = list(dict1.items())
max_count = []
len_val_iterable = 0

i = 0
for tup in list4:
tup = list4[i:i+1]
tup_pop = tup.pop()
tup_val = list(tup_pop[1:])
flat_list = []
for sublist in tup_val:
for item in sublist:
flat_list.append(item)
len_val = len(flat_list)

if len_val > len_val_iterable:
len_val_iterable = len_val
max_count = tup_pop[0:1]
elif len_val == len_val_iterable:
max_count = max_count + tup_pop[0:1]
i +=1
``` 