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 trialReynaldo Ponte
669 PointsHi Guys i think i am understand this Tuples challenge wrong, can you help?
Hi guys. This challenge is asking to return a tuple with four versions of a string. this is my code....I dont know where i am going wrong. Can you help? Thanks
#version 1
def stringcases():
sting='the string'
case=(sting.upper(),sting.lower(),sting.title(),sting[::-1])
(a,b,c,d)=case
return (a,b,c,d)
#version 2
def stringcases():
sting='the string'
case=(sting.upper(),sting.lower(),sting.title(),sting[::-1])
return case
thanks again Rey
1 Answer
Daniel Reedy
25,284 PointsI believe you might be misunderstanding the question. Here it is again: "Create a function named stringcases that takes a string and returns a tuple of four versions of the string: uppercased, lowercased, titlecased (where every word's first letter is capitalized), and a reversed version of the string."
Rather than specifying the string within the function you need to allow the user to provide it. def stringcases(the_string):
That should get you going enough to complete the exercise as the rest of your code looks like it should work (try fixing your version 2)
Reynaldo Ponte
669 PointsReynaldo Ponte
669 PointsHi Daniel. Thanks for your help. I was able to fix the error I made. I noticed I had to make the argument and the string in my function the same.
Thanks Rey