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 (Retired) Tuples Stringcases

Suleiman Abdurozikov
Suleiman Abdurozikov
2,943 Points

Please help

Couldn't understand howto do !!

stringcases.py
Create a function named stringcases that takes a string and returns 
a tuple of four versions of the string: uppercased, lowercased, titlecased 
    (where every word's first letter is capitalized), and a reversed version of the string.



def stringcases(how,how,how,how):
    string_list = [how,how,how,how]
    for index,value in enumerate(string_list):
        return("{},{}".format(index,value.upper(),value.lower(),value.title(),value[:-1]))

1 Answer

Brian Jensen
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree seal-36
Brian Jensen
Treehouse Staff
def stringcases(my_string):
  return (my_string.upper(), my_string.lower(), my_string.title(), my_string[::-1])