-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05-b.py
More file actions
31 lines (24 loc) · 728 Bytes
/
Copy path05-b.py
File metadata and controls
31 lines (24 loc) · 728 Bytes
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
class Bank:
bank_balance = 0
def __init__(self):
self.account_name = None
self.age = None
self.amount = None
def account(self):
self.account_name = input("Enter name: ")
self.age = input("Enter age: ")
self.amount = int(input("Enter amount: "))
if self.amount:
Bank.bank_balance += self.amount
return self.account_name
@classmethod
def show_bank_balance(cls):
print("Total Balance: ", cls.bank_balance)
LC = dict()
n = int(input("Enter number of accounts: "))
for i in range(n):
new_account = Bank()
key = new_account.account()
if key:
LC.setdefault(key, new_account)
Bank.show_bank_balance()