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

Nikki Wong
Nikki Wong
9,066 Points

I feel like i'm getting more stupid. there really should be a preview option because I can't see where I'm going wrong?

I'm returning the tuple requested yet it says i'm returning the wrong thing?

stringcases.py
def stringcases(string):

    stringCopy = string[:]
    stringCopy.split()
    for word in stringCopy:
        word[0].upper()
    " ".join(stringCopy)

    stringR = string[:]
    stringR = [-1::-1]

    stringupper = string[:].upper()
    stringlower = string[:].lower()

    return (stringupper, stringlower, stringCopy, stringR)

1 Answer

Steven Parker
Steven Parker
231,269 Points

The instructions say you should return 4 formats: All uppercase, All lowercase, Titlecased, and Reversed.

It looks like you have the first 2, but for the third the code seems to be trying to do something with words instead of characters. Why not take advantage of the challenge's hint: "There are str methods for all but the last one."?

Then for the last, you have slice parameters set up but the slice is not applied to anything:

    stringR = [-1::-1]

there should be something between the "=" and the "[".

Nikki Wong
Nikki Wong
9,066 Points

thanks again!