LearnPy Hub
← Classes & Objects problems
Medium

Transfer Between Accounts

Write class Account with an owner, a balance and a method transfer(other, amount) that moves money only if there is enough (returns True or False). Read two opening balances and then transfer amounts from A to B; print ok or failed for each, then both balances.

Input

Two balances, then amounts on one line.

Output

Lines.

Sample 1

Input
100
0
30 80 70
Output
ok
failed
ok
0 100

Sample 2

Input
50
50
50
Output
ok
0 100
solution.py
Output appears here
Transfer Between Accounts · Python practice problem · LearnPy Hub