class BankAccount:
    def __init__(self, number, balance=0):
        if balance < 0:
            raise ValueError("Cannot create an account with negative balance.")
        self.number = number
        self.balance = balance

    def deposit(self, amount):
        if amount < 0:
            raise ValueError("Account number {}: cannot deposit a negative amount.".format(self.number))
        self.balance += amount

    def withdraw(self, amount):
        if amount < 0:
            raise ValueError(f"Account number {self.number}: cannot withdraw a negative amount.")
        if amount > self.balance:
            raise ValueError(f"Account number {self.number}: cannot withdraw {amount} (current balance: {self.balance})")
        self.balance -= amount

    # pozostałość z 1. semestru, tu nie używamy
    def merge_to(self, other_account):
        pass

    def __str__(self):
        return f"Account number {self.number}, balance: {self.balance}"


if __name__ == "__main__":
    account = BankAccount("1234-BANK-0000", 10000)
    print(account)  # 1
    account.deposit(500)
    print(account)  # 2
    account.withdraw(8000)
    print(account)  # 3

    another_account = BankAccount("9999-BANK-0000")
    print(another_account)  # 4

