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 Collections (2016, retired 2019) Tuples Stringcases

Hrithik Sharma
Hrithik Sharma
6,090 Points

It Works in my vs code but not in code challenge

it does work in my code editor but not in code challenge it says bummer: try again! i know there is simple way to do it but this should also work my code is

stringcases.py
def stringcases (str):
    lower = []
    upper = []
    capitalize = []
    reverse = []
    for letter in list((str.lower())):
        lower.append(letter)

    for letter in list((str.upper())):
        upper.append(letter)


    for letter in list((str.title())):
        capitalize.append(letter)

    for letter in list(reversed(str)):
        reverse.append(letter)

    return tuple(upper), tuple(lower), tuple(capitalize), tuple(reverse)

1 Answer

Each individual string value returned isn't a tuple. Instead of this:

return tuple(upper), tuple(lower), tuple(capitalize), tuple(reverse)

the following passes:

return ''.join(upper), ''.join(lower), ''.join(capitalize), ''.join(reverse) 
Hrithik Sharma
Hrithik Sharma
6,090 Points

thank you for your answer