Welcome to the Treehouse Community
Looking to learn something new?
Sohail MirzaPython Web Development Techdegree Student 5,158 Points
why does it return a tuple
I understand the objective but i dont understand how this returns a tuple. Could someone explain why does this return tuple
def stringcases(something): return str(something).upper(), str(something).lower(), str(something).title(), something[::-1]
Steven Parker216,057 Points
Any comma-separated list of things is a tuple, unless enclosed in something that explicitly creates another type (like brackets for a list, braces for a dictionary, etc.).
Hie, maybe you would want to first define your variable 'str' in the function before "return", then put everything in brackets before the commas. Example: str = (something.upper()), (something.lower())....
Then you "return" your variable...return str