본문 바로가기
파이썬 코딩테스트/프로그래머스

프로그래머스 / 프린터 / 파이썬

by S.T.Lee 2022. 9. 14.
def solution(priorities, location):
    num_list = [(i,p) for i,p in enumerate(priorities)]
    answer = 0
    while True:
        current = num_list.pop(0)
        if any(current[1]<i[1] for i in num_list):
            num_list.append(current)
        else:
            answer += 1
            if current[0] == location:
                break
    return answer