Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Conversion from CamelCase by imloafer
import re
def from_camel_case(name: str) -> str:
# replace this for solution
name = re.sub(r'([A-Z])', lambda m: '_' + m[0].lower(), name)
return name.lstrip('_')
print("Example:")
print(from_camel_case("MyFunctionName"))
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!")
Oct. 7, 2022
Comments: