| Total Complexity | 2 |
| Total Lines | 15 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | def to_camel_case(name: str) -> str: |
||
| 2 | return ''.join(map(lambda x: x[0].upper() + x[1:], name.split('_'))) |
||
| 3 | |||
| 4 | |||
| 5 | if __name__ == '__main__': |
||
| 6 | print("Example:") |
||
| 7 | print(to_camel_case('name')) |
||
| 8 | |||
| 9 | # These "asserts" using only for self-checking and not necessary for auto-testing |
||
| 10 | assert to_camel_case("my_function_name") == "MyFunctionName" |
||
| 11 | assert to_camel_case("i_phone") == "IPhone" |
||
| 12 | assert to_camel_case("this_function_is_empty") == "ThisFunctionIsEmpty" |
||
| 13 | assert to_camel_case("name") == "Name" |
||
| 14 | print("Coding complete? Click 'Check' to earn cool rewards!") |
||
| 15 |