JustCaptain kod-buduschego
278f89b670625c4e4b01e3ae728782f1780fa610
Перейти к файлу
Код
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)