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 Question Does anyone know how to solve this? Code has to make test pass.

Code

def list_of_chars(list_chars):
    # TODO: Implement me
    return

Test

# %load test_reverse_string.py
from nose.tools import assert_equal


class TestReverse(object):

    def test_reverse(self):
        assert_equal(list_of_chars(None), None)
        assert_equal(list_of_chars(['']), [''])
        assert_equal(list_of_chars(
            ['f', 'o', 'o', ' ', 'b', 'a', 'r']),
            ['r', 'a', 'b', ' ', 'o', 'o', 'f'])
        print('Success: test_reverse')


def main():
    test = TestReverse()
    test.test_reverse()


if __name__ == '__main__':
    main()

Hi Dana

you are doing an asset_equal and passing a list to your function list_of_chars, and comparing it to ['r', 'a', 'b', ' ', 'o', 'o', 'f'] but what does the function list_of_chars actually do?

1 Answer

I'm pretty new to Python and I'm really not sure how to answer your question Andreas Cormack. This is a problem I need to solve on an activity I'm doing...pretty lost on how to get the "Code" to pass the "Test".