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 trialMarco Koopman
5,290 PointsHow to get a single word from a string and put it in a tuple?
Hey Im stuck on this assignment. I don't know how to get a single word out of a string and put it in a tuple. Can someone please show me how this is done?
1 Answer
Grigorij Schleifer
10,365 PointsHi Marco,
def stringcases(single_string):
return (single_string.upper(),
single_string.lower(),
single_string.title(),
single_string[::-1])
The method returns a tuple with four items. First three use build in python functions and the last one is a nice sliced one
Does this help?
Marco Koopman
5,290 PointsMarco Koopman
5,290 PointsHey!
Thanks alot, I was thinking way too difficult. I didn't know you could just make a tuple like that but now I do so thanks :)!!
Grigorij Schleifer
10,365 PointsGrigorij Schleifer
10,365 PointsHey Marco, you are very welcome. Keep up the hard work