def gcd(n1, n2):
if n1<n2:
(n1, n2) = (n2, n1)
while n2 != 0:
(n1, n2) = (n2, n1 % n2)
return n1
def solution(n,m):
return [gcd(n,m), (n * m) / gcd(n,m)]
'Language > Python' 카테고리의 다른 글
[Python / 프로그래머스 level 1] 직사각형 별찍기 (0) | 2021.06.16 |
---|---|
[Python / 프로그래머스 level 1] x만큼 간격이 있는 n개의 숫자 (0) | 2021.06.16 |
[Python / 프로그래머스 level 1] 행렬의 덧셈 (0) | 2021.06.15 |
[Python / 프로그래머스 level 1] 평균 구하기 (0) | 2021.06.14 |
[Python / 프로그래머스 level 1] 짝수와 홀수 (0) | 2021.06.14 |