#КошелёкНаPython

Код из видео:



def record(total):

with open('text.txt', 'w') as txt:

txt.write(str(total))

print('Баланс обновлён: ', total)



def readd(operation):

with open('text.txt', 'r') as txt:

txt = txt.read()

balance = float(txt)



if operation == 'д':

howMany = float(input('Сколько: '))

record(float(txt) + howMany)

elif operation == 'о':

howMany = float(input('Сколько: '))

record(float(txt) - howMany)

elif operation == 1:

print('На балансе ' + str(balance) + 'руб \n')





while True:

readd(1)

readd(input('Добавить/Отнять\n Д/О: ').lower())