[Python][프로그래머스][Level2] 예산

[Python][프로그래머스][Level2] 예산

코드

def solution(d, budget):
    ck=answer=0
    for i in sorted(d):
        ck+=i
        if ck<=budget:
            answer+=1
        else:
            break
    return answer

Discussion and feedback