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 trialQUYEN NGUYEN
5,100 PointsCan somebody point out where did my logic go wrong please !! TUPLE
the challenge said I return wrong string
def stringcases(string):
lower_case=string.lower()
upper_case=string.upper()
capitalize_case=string.capitalize()
string_list=list(string)
reverse = ''.join(string_list[::-1])
tuple_collection= upper_case,lower_case,capitalize_case,reverse
return tuple_collection
1 Answer
josephr
18,877 PointsI think your reverse is wrong. Try something like
reverse = string[-1::-1]
A string is already iterable so you do not need to convert it into a list. You also start with the first element/ Start with last element and step backwards through the entire string.