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

procedure to obtain the letters of a string arranged in reverse way

Following piece of code worked fine when i tried to run it in local machine , but code challenge window says "got the wrong output"

def stringcases (string): l=[] l.extend(string) l1=l[-1::-1] string2=''.join(l1) tuple2=(string.upper(),string.lower(),string.capitalize(),string2) return tuple2

stringcases.py
def stringcases (string):
    l=[]
    l.extend(string)
    l1=l[-1::-1]
    string2=''.join(l1)
    tuple2=(string.upper(),string.lower(),string.capitalize(),string2)
    return tuple2

def stringcases (string): l=[] l.extend(string) l1=l[-1::-1] string2=''.join(l1) tuple2=(string.upper(),string.lower(),string.title(),string2)

return tuple2

I got to know my mistake , title() command need to be used instead of capitalize()

1 Answer

def stringcases (string): l=[] l.extend(string) l1=l[-1::-1] string2=''.join(l1) tuple2=(string.upper(),string.lower(),string.title(),string2)

return tuple2