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.

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...