-
Notifications
You must be signed in to change notification settings - Fork 0
/
transactions.py
39 lines (29 loc) · 907 Bytes
/
transactions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys
from bank import (handle_withdrawal, handle_overdraft,
get_balance, account_balances)
account_details = {
'name': 'Damilare Onajole',
'number': 9027303872
}
def withdraw_funds(value, account):
import pdb; pdb.set_trace()
balance = get_balance(account)
if balance <= 0:
account = 'overdraft'
new_balance = handle_overdraft(value)
else:
new_balance = handle_withdrawal(account, value)
print("\t\tYou new {account} balance is {new_balance}\n".format(
account=account,
new_balance=new_balance
)
)
print("\nWelcome {}\n".format(account_details['name']))
# check account balance
if len(sys.argv) == 1:
print("\t\tYou account balance is {account_balance} \n".format(
account_balance=account_balances
))
else:
# or withdraw funds
withdraw_funds(int(sys.argv[1]), sys.argv[2])