return balance
- amount
Line breaks in Python or any language assumes that a new statement has started. Python is a dynamic language, so you can't simply check for compilation errors and end of a statement ; is not used in Python. So in the above code balance is returned. The interpreter never reaches - amount which never throws a error.
To write a statement in multiple lines you use \ character to notify the interpreter that the next line is a part of the current statement.
return balance \ # Line below is a part of current statement.
- amount
Also floating point is not a bug of python but the underlying platform handling numbers. It happens because it is the way the underlying c platform (on which python works in a sense) handles floating-point numbers. Floating point error is not a bug. Stackoverflow
PS : Apologies. My intensions are not to criticize. Just sharing my opinions.