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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Ning Tian](https://secure.gravatar.com/avatar/e476d9ad986228b9aa1cee7a4e9255da?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ning Tian
1,436 PointsCan't get correct reversed string
I tried both following, just cannot get the correct answer. Please let me know what is wrong:
def stringcases(string): a = string.upper() b = string.lower() c = string.capitalize() d = list(string) d.reverse reve = "".join(d) tpl = (a, b, c, reve) return tpl
def stringcases(string): a = string.upper() b = string.lower() c = string.capitalize() d = string.split() d.reverse reve = " ".join(d) tpl = (a, b, c, reve) return tpl
def stringcases(string):
a = string.upper()
b = string.lower()
c = string.capitalize()
d = list(string)
d.reverse
reve = "".join(d)
tpl = (a, b, c, reve)
return tpl
4 Answers
![Noel Barcelona](https://secure.gravatar.com/avatar/372fd4dcef08ab3f4a179dc13442fa00?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Noel Barcelona
Courses Plus Student 495 Pointsif you want to reverse a sting, you can do this:
a = someString
reversedString = a[::-1]
this is in python3 btw.
![Noel Barcelona](https://secure.gravatar.com/avatar/372fd4dcef08ab3f4a179dc13442fa00?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Noel Barcelona
Courses Plus Student 495 Pointsoh, it's because you're converting the string into a List. It's asking for a string data type, not List data type.
d = list(string) #remove this line of code#
d = string[::-1] #and replace it with this#
you can check out all string operations here: https://docs.python.org/3/library/stdtypes.html#string-methods
reading the documentation can be a bit tedious but really rewarding.
![Ning Tian](https://secure.gravatar.com/avatar/e476d9ad986228b9aa1cee7a4e9255da?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ning Tian
1,436 PointsThanks a lot. In my original code, the list gets joined into a string. but, I have tried [::-1], still cannot get to pass the challenge........ T T
![Noel Barcelona](https://secure.gravatar.com/avatar/372fd4dcef08ab3f4a179dc13442fa00?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Noel Barcelona
Courses Plus Student 495 PointsYou can still use your original code just add open and close parenthesis in "d.reverse" so it becomes "d.reverse()" you have to call the function 'reverse'
![Ning Tian](https://secure.gravatar.com/avatar/e476d9ad986228b9aa1cee7a4e9255da?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ning Tian
1,436 PointsThanks a lot!!! Great catch, but still cannot get pass. I mean "reversed" means to make "ab c" to "c ab", right?
![Ning Tian](https://secure.gravatar.com/avatar/e476d9ad986228b9aa1cee7a4e9255da?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ning Tian
1,436 PointsSomeone just answered my question and then the answer disappeared. However, that answer was the correct one. I should have used .title(), rather than .capitalize(). No idea the system keeps saying "Got the wrong string for Reversed" ..... Got passed now!! Thank you all!!!!
![Derek Woods](https://secure.gravatar.com/avatar/d8209f05f0a426a9b1bfd98c1ea35fec?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Derek Woods
6,272 Pointssorry about that i deleted it because by the time i answered there was 3 other answers
Ning Tian
1,436 PointsNing Tian
1,436 PointsThanks a lot. But still can't got the write answer..... Actually, here is the question:
Create a function named stringcases that takes a single string but returns a tuple of different string formats. The formats should be: All uppercase All lowercase Titlecased (first letter of each word is capitalized) Reversed