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

conversion_into_camelcase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A to_camel_case() 0 2 2
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