https://school.programmers.co.kr/learn/courses/30/lessons/12947
def solution(x):
answer = True
x = str(x)
sum = 0
for i in x:
sum += int(i)
if int(x)%sum == 0:
return answer
else:
return False
'Coding Test > 프로그래머스' 카테고리의 다른 글
[Level 1] / [Python] 정수 내림차순으로 배치하기 (0) | 2022.10.12 |
---|---|
[Level 1] / [Python] 문자열을 정수로 바꾸기 (0) | 2022.10.12 |
[Level 1] / [Python] 문자열 내 p와 y의 개수 (0) | 2022.10.12 |
[Level 1] / [Python] 정수 제곱근 판별 (0) | 2022.10.12 |
[Level 1] / [Python] 자연수 뒤집어 배열로 만들기 (0) | 2022.10.12 |