Listing 10 - Page 0: No Title

##############################################################################
# Python From Scratch
# Autor: Nilo Ney Coutinho Menezes
# Editora Novatec (c) 2010-2024
# Site: https://pythonfromscratch.com
#
# File: listing\chapter 10\10.1470 - No Title.py
# Description: No Title
##############################################################################

class BankException(Exception):
    pass

class UnavailableAmount(BankException):
    pass

class ClientDoesntExist(BankException):
    pass

def withdrawal(balance, amount):
    if amount > balance:
        raise UnavailableAmount
    return balance - amount

try:
    balance = withdrawal(100, 500)
except UnavailableAmount:
    print("Error: Insufficient balance")
Click here to download the file