Skip to content

Bank account · ⁨银行账户⁩

English

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.

中文

银行账户

一个很小的银行:按照一串指令操作,并且绝不让余额低于零。

"deposit 50".split() 按空格把字符串拆成 ["deposit", "50"]。金额仍然是文字,所以要用 int() 转换。在取款改变余额之前,先检查钱够不够;被拒绝的取款什么也不做。

Log in or create account · ⁨登录或创建账户⁩

IGCSE, A-Level · ⁨IGCSE、A-Level⁩ & AP · ⁨与 AP⁩