Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
if it works it not shit solution in Uncategorized category for Conversion into CamelCase by danersow
def to_camel_case(name):
name_list = list(name)
for n in range(len(name_list)):
if name_list[n] == "_":
name_list[n+1]=name_list[n+1].upper()
name_list[0] = name_list[0].upper()
result = ""
for i in name_list:
result += i
return result.replace("_","")
if __name__ == '__main__':
print("Example:")
print(to_camel_case('name'))
#These "asserts" using only for self-checking and not necessary for auto-testing
assert to_camel_case("my_function_name") == "MyFunctionName"
assert to_camel_case("i_phone") == "IPhone"
assert to_camel_case("this_function_is_empty") == "ThisFunctionIsEmpty"
assert to_camel_case("name") == "Name"
print("Coding complete? Click 'Check' to earn cool rewards!")
Jan. 20, 2020