JustCaptain kod-buduschego
llm/change-d17f82
Перейти к файлу
Код
task_3.py
"""
3. Глобальный банк
Есть глобальная переменная: balance = 1000
Реализуй функции: deposit(amount); withdraw(amount)
После каждой операции баланс должен изменяться.
Пример:
deposit(500)
withdraw(200)
print(balance)  # 1300
"""

BALANCE: int = 1000


def deposit(amount: int) -> None:
    global BALANCE
    BALANCE = BALANCE + amount


def withdraw(amount: int) -> None:
    global BALANCE
    BALANCE = BALANCE - amount


deposit(500)
withdraw(200)
print(BALANCE)