Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

most_courses works in Visual studio not in treehouse, why??

def most_courses(dict):
    count = 0
    teacher = ()
    for teachers,subjects in dict.items():
        if (len(subjects)) > count :
            count += len(subjects)
            teacher = teachers     
    return(teacher)


def stats (dict):
    teachers_list= []
    for teachers,subjects in dict.items():
        teachers_list.append(teachers) 
        teachers_list.append(len(subjects))
    return(teachers_list)

Why is this not working for the most_courses questions? I've put both my solutions in now, cause I got them both to give the right answer in VSC and not on the treehouse app.

1 Answer

Daniel Adari
Daniel Adari
3,577 Points

Can you please describe the task? I don't have access to this specific task so I can't help...