-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank.py
65 lines (49 loc) · 2.15 KB
/
bank.py
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
# Source Code
print("\t\t\t***** BankWithUs *****")
bank_data = {}
while True:
print("\n\n\t\t\t----- Main Menu -----")
ch = int(input("\n\n1.New Customer\n2.Existing Customer\n3.Exit\n\nEnter choice:"))
if ch == 1:
name = input("\nEnter name:")
city = input("Enter city:")
age = int(input("Enter age:"))
acc = input("Enter account type:")
amt = int(input("Enter amount:"))
acc_no = int(input("Enter account no:"))
user_data = {}
user_data["name"] = name
user_data["city"] = city
user_data["age"] = age
user_data["account"] = acc
user_data["amount"] = amt
bank_data[acc_no] = user_data
print("\nACCOUNT CREATED\n")
elif ch == 2:
acc_no = int(input("Enter account no:"))
if acc_no in bank_data:
print("\nACCOUNT EXISTS\n")
while True:
print("\n\n\t\t\t----- User Portal -----")
choice = int(input("\n1.Check Balance\n2.Withdraw\n3.Deposit\n4.Back to main menu\n\nEnter choice:"))
if choice == 1:
print("\nYour available balance:",bank_data[acc_no]["amount"])
elif choice == 2:
withd = int(input("\nEnter withdraw amount:"))
bank_data[acc_no]["amount"] = bank_data[acc_no]["amount"] - withd
print("\nAmount withdrawn, now your available balance is %i"%bank_data[acc_no]["amount"])
elif choice == 3:
dep = int(input("\nEnter deposit amount:"))
bank_data[acc_no]["amount"] = bank_data[acc_no]["amount"] + dep
print("\nAmount deposited, now your available balance is %i"%bank_data[acc_no]["amount"])
elif choice == 4:
break
else:
print("\n\nINVALID CHOICE!")
else:
print("\nACCOUNT NOT FOUND\n")
elif ch == 3:
break
else:
print("\n\nINVALID CHOICE!")
print("\n\n***** Thank you for banking with us *****")