Function 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:])
KRIS NIKOLAISENPro Student 49,791 Points
If 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 Goyal4,575 Points
So 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"