프로그래머스. 하샤드 수 파이썬 풀이

minan·2021년 6월 28일
0

프로그래머스

목록 보기
63/92

프로그래머스. 연습문제. Level 1. 하샤드 수 파이썬 풀이

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

def solution(x):
    # 각 자릿수를 배열에 담음
    array = list(map(int, str(x)))
    # x가 각 자릿수의 합으로 나우어 떨어진다면 True 리턴
    return True if x % sum(array) == 0 else False
profile
https://github.com/minhaaan

0개의 댓글