본문 바로가기
프로그래밍 문제/[Python] CheckIO

[Check-IO] Conversion into CamelCase

by UltraLowTemp-Physics 2021. 12. 25.
728x90

[1] Problem: https://py.checkio.org/en/mission/conversion-into-camelcase/
[2] My solutions 

def to_camel_case(name: str) -> str:
    #replace this for solution
    
    dummy_list = list(map(lambda x: x.capitalize(), name.split('_')))
    
    return "".join(dummy_list)

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!")
728x90

'프로그래밍 문제 > [Python] CheckIO' 카테고리의 다른 글

[CheckIO] Count Vowels  (0) 2024.02.18
[Check IO] words-order  (0) 2022.02.27
[Check-IO] Conversion from CamelCase  (0) 2021.12.20
[Check-IO] The Most Wanted Letter  (0) 2021.12.19
[Check-IO] Follow Instructions  (0) 2021.12.18

댓글