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

Help with tuples and strings...

What's wrong?

stringcases.py
def stringcases(string):
    return string.upper(), string.lower(), string.capitalize(), string[::-1]

1 Answer

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

The challenge is asking for

Titlecased (first letter of each word is capitalized)

You function outputs the following incorrect tuple:

#  your function
def stringcases(string):
    return string.upper(), string.lower(), string.capitalize(), string[::-1]

print(stringcases('abc DEF gHi jkL'))  #  simple silly test case

#  your output
('ABC DEF GHI JKL', 'abc def ghi jkl', 'Abc def ghi jkl', 'Lkj iHg FED cba')

#  desired output
('ABC DEF GHI JKL', 'abc def ghi jkl', 'Abc Def Ghi Jkl', 'Lkj iHg FED cba')

Thanks! Why are we not able to see all of the test cases and outputs? That would be a lot more useful then asking for every test case fail what is wrong?

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Not sure, but that was just a test case I created. My guess is that you need to create your own test cases and test your own code. To me, testing is the most important part of coding (just one goofball's opinion) :smile: