From Snake to Camel
In real code, names often need to be converted from one naming style to another. The function snake_to_camel receives a string written in snake_case. Remove the underscores, capitalize the first letter of each word, and return the result in CamelCase.
Примеры
Ввод
"hello_world"Вывод
"HelloWorld"Ввод
"a_b_c"Вывод
"ABC"Ввод
"single"Вывод
"Single"Нужно реализовать
def snake_to_camel(s: str) -> str:
Теги
strings
Idħol biex tara l-istorja tas-sottomissjonijiet
IdħolIdħol biex tuża l-Mentor tal-AI
IdħolVisible tests
1
Input
"hello_world"Expected
"HelloWorld"2
Input
"a_b_c"Expected
"ABC"3
Input
"single"Expected
"Single"4
Input
"my_var_name"Expected
"MyVarName"5
Input
""Expected
""6
Input
"dlrow_olleh"Expected
"DlrowOlleh"Focus radio
Paused · SomaFM · Fluid