def solution(weight, D, A):
    mood = A
    for i in range(1, D):
        diff = weight[i] - weight[i-1]
        
        if diff > 0:
            mood -= diff * 10
            
        elif diff < 0:
            mood += abs(diff) * 2
            
    return mood 

weight = [50,60,70,60,50]
D = 5
A = 0
ret = solution(weight, D, A)
print("solution 함수의 반환 값은", ret, "입니다.")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: