-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBank system.py
More file actions
56 lines (48 loc) · 1.45 KB
/
Copy pathBank system.py
File metadata and controls
56 lines (48 loc) · 1.45 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
52
53
54
55
56
def show_balance():
print("**************************")
print("your balance is: ${:.2f}".format(balance))
print("**************************")
def deposit():
print("**************************")
amount = float(input("Enter an amount to be deposited: "))
print("**************************")
if amount < 0:
print("That's not a valid amount")
return 0
else:
return amount
def withdraw():
print("**************************")
withdrawal_amount = float(input("Enter the withdrawal amount: "))
print("**************************")
if withdrawal_amount > balance:
print("Insufficient balance")
elif withdrawal_amount < 0:
print("Invalid amount")
else:
return withdrawal_amount
balance = 0
is_running = True
while is_running:
print("\n**************************")
print(" Banking program ")
print("**************************")
print("1. Show Balance")
print("2. Deposit")
print("3. Withdraw")
print("4. exit")
choice= int(input("Enter your Choice(1-4) : "))
if choice == 1:
show_balance()
elif choice == 2:
balance += deposit()
show_balance()
elif choice == 3:
balance -= withdraw()
show_balance()
elif choice == 4:
is_running = False
else:
print("Enter a valid choice")
print("Thank you, Have a nice day")
print("\n")