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

Sam Lozier
Sam Lozier
9,699 Points

Python teacher stats Challenge task 4 isn't passing with "didn't get the right teacher name" as the error. [Solved]

My code is working correctly in Pycharm IDE.

def most_courses(tdick):
    t_most = ""
    tmcount = 0
    for t,c in tdick.items():
        if len(c) >  tmcount:
            t_most = t
            tmcount = len(c) #forgot this part...
        else:
            continue
    return t_most

It doesn't offer any error checking for a tie, but that hasn't caused any of the previous steps to have failed.

Thoughts?

Sam Lozier
Sam Lozier
9,699 Points

Never-mind, I realized I'd forgotten to update the tmcount variable