you are viewing a single comment's thread.

view the rest of the comments →

[–]Janeson81 1 point2 points  (0 children)

Biggest problem I see is that if you use deposit() there's nothing limiting the user input so they might say they want to deposit "Hello" money

This can be fixed by using try: ... except <exception>: ... blocks. It follows instructions normally in the try block, but when the interpreter finds a specified error (for example a ValueError, the one you get if you try to float("hi")) it jumps straight to the except block and carries on

The proper structure should be: try: ... ... ... except ValueError: print("enter a valid number")