프로그래머스. 자릿수 더하기 파이썬 풀이

minan·2021년 6월 25일
0

프로그래머스

목록 보기
56/92

프로그래머스. 연습문제. Level 1. 자릿수 더하기 파이썬 풀이

문제링크 https://programmers.co.kr/learn/courses/30/lessons/12931

숫자 n을 str 형식으로 바꾸어 list 형식으로 바꾸고 map을 이용해 int로 매핑한 후 sum

한줄컷

def solution(n):

    return sum(map(int, list(str(n))))
profile
https://github.com/minhaaan

0개의 댓글

관련 채용 정보

Powered by GraphCDN, the GraphQL CDN