Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
one-liner solution in Clear category for Conversion from CamelCase by Max0526
def from_camel_case(name: str) -> str:
return ''.join([] + [("_" + i.lower())*i.isupper() + i*i.islower() for i in name])[1:]
print("Example:")
print(from_camel_case("MyFunctionName"))
# These "asserts" are used for self-checking
assert from_camel_case("MyFunctionName") == "my_function_name"
assert from_camel_case("IPhone") == "i_phone"
print("The mission is done! Click 'Check Solution' to earn rewards!")
April 26, 2023