Passed
Push — master ( 10bb29...fdd8aa )
by Ken M.
01:46
created

conversion_into_camelcase.to_camel_case()   A

Complexity

Conditions 2

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 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