💻 하나씩 차곡차곡/프로그래머스 (Python)

[프로그래머스/python/Lv1] 부족한 금액 계산하기

뚜루리 2023. 12. 17. 13:33
728x90
320x100
def solution(price, money, count):
    answer = 0

    for i in range(1, count+1):
        answer += price*i

    if answer <= money :
        return 0

    return answer - money

첨에 저 if 부분을 안해가지고, 정확도가 95?나와서 한참 고생함. 문제를 잘 읽자...!

728x90
320x100