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

fahad lashari
fahad lashari
7,693 Points

Solution is correct or may be not? a little help plz?

The solution I implemented provides exactly the output being requested in the question. However I am still get the result that my solution is incorrect. Any input as to what I need to fix. Would be much appreciated.

kind regards,

Fahad

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

1 Answer

andren
andren
28,558 Points

The problem is with the third format, the instructions are to make it be Titlecased, which is actually different from simply being capitalized (even though the task instructions does not make that super clear).

A Titlecased string is one where each word starts with a capital letter, for example Hello World!. The capitalize function only capitalizes the first word in a string so it will look like this Hello world!.

To make a string Titlecased you can use the title function.

fahad lashari
fahad lashari
7,693 Points

Ahhhhhh I guess the wording of the question is not the best then. Thanks a bunch!

Kind regards,