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 trialAlec Schneider
1,673 PointsFunction naming incorrect on Python Collections sillycase challenge making the code checker unable to find my method.
I think the code checker has some other method name it is looking for instead of the 'sillycase' function name requested in the problem description. This is resulting in an error "Couldn't find 'sillycase'." being thrown.
def sillycase(string):
split_loc = int(len(string))
return lower(string[:split_loc]) + upper(string[split_loc:])
2 Answers
KRIS NIKOLAISEN
54,972 PointsIf you run your code in a workspace you'll receive a better error message.
NameError: name 'lower' is not defined
This is why the function can't be found. According to the python docs use str.lower() to convert to lowercase - meaning (string[:split_loc]).lower(). The same error will occur with upper.
You also need to work with halves of the string so split_loc should include divide by 2.
Robin Goyal
4,582 PointsSo there are no built-in functions in Python that are called upper and lower. These are methods that are tied to the Python str object. You have to do str.upper or str.lower.
>>> string = "Hello"
>>> string.upper()
"HELLO"
>>> string.lower()
"hello"