Skip to content

Commit 72edbad

Browse files
committed
Use nested f string
1 parent d5c8c88 commit 72edbad

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lab-11/atm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ def main_menu(id):
3434
")
3535
selection = int(input("Enter your selection here: "))
3636
if (selection == 1):
37-
print(eval(f"account_{id}.get_balance()"))
37+
print(f"${eval(f'account_{id}.get_balance()')} in account {id}")
3838
get_id()
3939
elif (selection == 2):
4040
withdraw_amount = float(
4141
input("Enter the amount of money you would like to withdraw: "))
4242
eval(f"account_{id}.withdraw({withdraw_amount})")
43-
print(f"${withdraw_amount} was withdrawed successfully\nYour new balance is ${eval('account_'+ id + '.get_balance()')}")
43+
print(f"${withdraw_amount} was withdrawed successfully\nYour new balance is ${eval(f'account_{id}.get_balance()')}")
4444
get_id()
4545
elif (selection == 3):
4646
deposit_amount = float(
4747
input("Enter the amount of money you would like to deposit: "))
4848
eval(f"account_{id}.deposit({deposit_amount})")
49-
print(f"${deposit_amount} was deposited successfully\nYour new balance is ${eval('account_' + id + '.get_balance()')}")
49+
print(f"${deposit_amount} was deposited successfully\nYour new balance is ${eval(f'account_{id}.get_balance()')}")
5050
get_id()
5151
elif (selection == 4):
5252
exit()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy