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

Regarding Challenge 4

Hi, I kinda don't understand the question. I tried to print all the courses but the result was 65(higher than the answer). Why that happeded?

def courses(idx_dict):
    course_list = []
    for idx in idx_dict:
        for sub_idx in idx:
            course_list.append(sub_idx)
    return course_list

1 Answer

You are code would be much easier to work out and others to follow if you used more meaningful names, such as instead of 'idx', you said 'teacher' and instead of 'sub_idx' you said 'course'.

        for sub_idx in idx_dict[idx]:

It is also easier for people to help you if you use the 'Ask for help' button on the challenge as this will link anyone trying to help you directly with the challenge, without having to search.