Algorithm/codewars

Credit Card Mask 답안

Bonita SY 2021. 4. 1. 19:42
728x90
반응형

문제)

www.codewars.com/kata/5412509bd436bd33920011bc/train/python

 

Codewars: Achieve mastery through challenge

Codewars is where developers achieve code mastery through challenge. Train on kata in the dojo and reach your highest potential.

www.codewars.com

 

내가 푼 답)

# return masked string
def maskify(cc):
    return ''.join(['#' for _ in range(len(cc)-4)]) + cc[-4:] if len(cc) > 4 else cc

 

테스트 결과)

 

마음에 드는 남이 푼 답)

728x90
반응형

'Algorithm > codewars' 카테고리의 다른 글

IQ Test 답안  (0) 2021.04.01
Take a Ten Minute Walk 답안  (0) 2021.04.01
Format a string of names like 'Bart, Lisa & Maggie'. 답안  (0) 2021.04.01
Catching Car Mileage Numbers 답안  (0) 2021.04.01
Adding Big Numbers 답안  (0) 2021.03.30