File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1
1
# TODO: validate if id given is an integer
2
2
from account import Account
3
3
4
+ # for i in range(1, 9):
5
+ # eval(f"account_{i} = Account({i}, 100)")
6
+
4
7
account_1 = Account (1 , 100 )
5
8
account_2 = Account (2 , 100 )
6
9
account_3 = Account (3 , 100 )
@@ -37,14 +40,13 @@ def main_menu(id):
37
40
withdraw_amount = float (
38
41
prompt ("Enter the amount of money you would like to withdraw: " ))
39
42
eval (f"account_{ id } .withdraw({ withdraw_amount } )" )
40
- print (f"${ withdraw_amount } was withdrawed successfully\n Your new balance is { account_ { id } .get_balance ()} " )
43
+ print (f"${ withdraw_amount } was withdrawed successfully\n Your new balance is { eval ( ' account_' + id + ' .get_balance()' )} " )
41
44
get_id ()
42
45
elif (selection == 3 ):
43
46
deposit_amount = float (
44
47
prompt ("Enter the amount of money you would like to deposit: " ))
45
48
eval (f"account_{ id } .deposit({ deposit_amount } )" )
46
- print (f"${ deposit_amount } was deposited successfully\n \
47
- Your new balance is { account_ {id }.get_balance ()} " )
49
+ print (f"${ deposit_amount } was deposited successfully\n Your new balance is { eval ('account_' + id + '.get_balance()' )} " )
48
50
get_id ()
49
51
elif (selection == 4 ):
50
52
exit ()
You can’t perform that action at this time.
0 commit comments