[Python] 프로그래머스 - Level1 - 콜라츠 추측

강주형·2022년 8월 14일
0

https://school.programmers.co.kr/learn/courses/30/lessons/12943

연습문제

def solution(num):
    for i in range(500):
        if num == 1:
            return i
        if num % 2 == 0:
            num //= 2
        else:
            num = num * 3 + 1
    return -1
profile
Statistics & Data Science

0개의 댓글