-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankingSystem.py
More file actions
65 lines (48 loc) · 1.76 KB
/
BankingSystem.py
File metadata and controls
65 lines (48 loc) · 1.76 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
57
58
59
60
61
62
63
64
65
import math
Amount=0
balance=0
while(True):
print("\n**********************************")
print(" BANKING ")
print("**********************************")
print("\n1. Show Balance"
"\n2. Deposit"
"\n3. Withdraw"
"\n4. Exit")
print("\n-----------------------------------")
try:
choice = int(input("Enter your choice : "))
except ValueError:
print("Please enter a valid number!")
continue
print("-----------------------------------")
if choice==1:
print(f"Your Balance : ${balance}")
elif choice == 2:
try:
Amount = float(input("Enter the amount to be deposited : $"))
if Amount <= 0:
print("Amount should be greater than zero!")
else:
balance += Amount
print(f"${Amount} Deposited Successfully.")
except ValueError:
print("Invalid amount!")
elif choice == 3:
if balance == 0:
print("You have $0 in your account!")
else:
try:
With_Amount = float(input("Enter the amount to withdraw : $"))
if With_Amount <= 0:
print("Amount should be greater than zero!")
elif With_Amount > balance:
print("The amount you are trying to withdraw is more than balance.")
else:
balance -= With_Amount
print(f"${With_Amount} withdrawn successfully")
except ValueError:
print("Invalid amount!")
elif choice == 4:
print("\nThank you for using the Banking System.")
break