Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

David Wright
4,437 Pointsstringcases.py function returning a tuple with case changes from a string input
Not sure what's wrong with code
# Handy functions:
# .upper() - uppercases a string
# .lower() - lowercases a string
# .title() - titlecases a string
# There is no function to reverse a string.
# Maybe you can do it with a slice?
def stringcases(string):
up = string.upper()
lo = string.lower()
tit = string.title()
for itb in string:
rev = itb[::-1]
stringcases = (up, lo, tit, rev)
return stringcases
1 Answer

Kourosh Raeen
23,732 PointsTo reverse the string you don't need the for loop. Just do: rev = string[::-1]
David Wright
4,437 PointsDavid Wright
4,437 PointsI could have sworn I tried that.. GRRRRrrrrrRRR! Haha
Thanks Kourosh!