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 Functional Python Functional Workhorses Map

Andy McDonald
.a{fill-rule:evenodd;}techdegree seal-36
Andy McDonald
Python Development Techdegree Graduate 13,801 Points

Trouble counting backwards

I don't understand why my code isn't counting backwards.

backwards = [
    [5, 4, 3, 2, 1],
def reverse(var):
    answer =[]
    for itera in var:
        for i in range(len(itera), -1):
    answer = "".join(answer)
    return answer


1 Answer

Steven Parker
Steven Parker
229,644 Points

Here are a few hints:

  • the instructions ask for a function "that takes a single iterable item", not all of them at once
  • the function only needs to return the result, it doesn't need to print anything
  • in a range, you must specify a "stop" value along with a "step"
  • this code mismatches lists and strings, you might want to convert (split) the string first
  • do you remember slices? They might provide an even easier way to do this task