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__ROLLER__ Angel
25,606 PointsChallenge is particular about which str method you use
Wondering why I couldn't pass the challenge using .capitalize()
Once I swapped .capitalize() with .title() in my code, I was able to complete the challenge. Why didn't it let me use .capitalize() when it returns the same thing?
1 Answer
Torsten Lundahl
2,570 PointsActually they don't return the same result. capitalize() returns the string with only the very first letter capitalized. title() returns the string with the first letter in each word capitalized.
E. g.
"testing both methods".title()
> "Testing Both Methods"
"testing both methods".capitalize()
Ā > "Testing both methods"
__ROLLER__ Angel
25,606 Points__ROLLER__ Angel
25,606 PointsAhhh, is see. That makes sense now.
Thanks