A while loop that checks whether the value of account is zero would be a way to quit:
while account != 0:
Floating point zero is not always precisely zero:
>>> 27.33 - 25.0 - 2.33
-1.7763568394002505e-15
If account is a float variable, you have to make allowances for this:
while abs(account) < 0.000000001:
2
solved Python bank game won’t go back up [closed]