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 Python Collections (2016, retired 2019) Dictionaries Teacher Stats

hello for everyone i really need some help with this question, can somebody explain, what exactly am i doin wrong here?

i dont know if there is any problem in my code , so please help me with this

teachers.py
def courses (real):
    like =[]
    for re in real :
        for r in re.value():
        like.append(r)
    return like

1 Answer

Steven Parker
Steven Parker
229,644 Points

It looks like you're on one of the later tasks, but I don't see the code for the other tasks here. The challenge instructions include this notice: "Important: In each task of this code challenge, the code you write should be added to the code from the previous task." What that means is that you should leave the code you create for each task as-is, and put the code for the next task below it.

When the validator checks your work, it also re-checks all the tasks you did before.


Then, for the "courses" task, remember that iterating through a dictionary returns only the keys, so to access the value instead of "re.value()" you would use "real[re]".

And check the indentation. Anything that is part of a loop must be indented more than the loop statement itself.