본문 바로가기
프로그램

[파이썬] 문제 : 함수의 인수로 받고 리턴 하기

by 오디세이99 2022. 11. 29.
728x90
반응형

total = 0

def money(t, price):
    t += price            # 인수 total(t)에 가격 더하기
    return t              # 리턴 값

total = money(total, 3000)
total = money(total, 2000)
total = money(total, 1500)
print(total)

결과

6500
728x90
반응형

댓글