Bank account · 은행 계좌
Bank account
A tiny bank that follows a list of instructions and never lets the balance go below zero.
"deposit 50".split() breaks the string at its spaces into ["deposit", "50"]. The amount is still text, so convert it with int(). Check that there is enough money before a withdrawal changes the balance; a refused withdrawal simply does nothing.
은행 계좌
명령 목록을 따르고 잔고가 0보다 낮아지지 않는 작은 은행입니다.
"deposit 50".split()은 공백에서 문자열을 ["deposit", "50"]로 쪼개고, 금액은 여전히 텍스트이므로 int()으로 변환합니다. 인출이 잔고를 변경하기 전에 돈이 충분한지 확인하며, 거절된 인출은 아무런 작용도 하지 않습니다.
Write final_balance(actions). Each action is a string such as "deposit 50" or "withdraw 20". Start at 0, apply the actions in order, and refuse any withdrawal that would take the balance below 0. Return the final balance. · final_balance(actions)을 작성하십시오. 각 행동은 "deposit 50"이나 "withdraw 20"과 같은 문자열입니다. 시작금은 0이며, 행동을 순서대로 적용하되 잔고가 0 미만으로 떨어지는 인출은 거부하십시오. 최종 잔고를 반환하십시오.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.