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 trialdevssm
16,670 PointsNow use map() to create a variable named forwards. forwards should use reverse() to reverse the order of every item in b
I'm having a little trouble understanding why I get this error "Not all items were reversed correctly"
backwards = [
'tac',
'esuoheerT',
'htenneK',
[5, 4, 3, 2, 1],
]
def reverse(iterable):
return list(reversed(iterable))
forwards=list(map(reverse,backwards))
2 Answers
Cory Madden
7,120 PointsIt's not working because when you use "reversed" on a string it returns that object as an array of characters, so 'taC' becomes ['C', 'a', 't']. You need to reverse your iterables differently, such as variable[::-1]
devssm
16,670 PointsThanks so much, I insisted using "reversed", that I never took in mind that other way.