-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathBanking Program.py
More file actions
51 lines (38 loc) · 1.11 KB
/
Banking Program.py
File metadata and controls
51 lines (38 loc) · 1.11 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
balance=0
def show_balance():
print(f"Your balance is:${balance}")
def deposit():
global balance
dep_amount=int(input("Enter the amount to be deposited:$ "))
balance=balance+dep_amount
print(f"${dep_amount} has been deposited")
def withdraw():
global balance
with_amount=int(input("Enter the amount to be withdrawn:$ "))
if with_amount>balance:
print("Insufficient balance")
else:
balance=balance-with_amount
print(f"${with_amount} has been withdrawn")
def exit():
print("Thank you! Have a nice day!")
def main():
while True:
print("1. Show Balance")
print("2. Withdraw")
print("3. Deposit")
print("4. Exit")
choice=input("Enter an option: ")
if choice=="1":
show_balance()
elif choice=="2":
withdraw()
elif choice=="3":
deposit()
elif choice=="4":
exit()
break
else:
print("Invalid option. Try again!")
if __name__=="__main__":
main()