File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ from __future__ import print_function
2
+ import numpy as np
3
+
4
+
5
+ class Account :
6
+
7
+ def __init__ (self ):
8
+ self .amount = 0
9
+
10
+ def putMoney (self , deposit ):
11
+ print ("my amount is" , self .amount )
12
+ self .amount += deposit
13
+ print ("my amount is" , self .amount )
14
+
15
+ def takeMoney (self , withdrawal ):
16
+ self .amount -= withdrawal
17
+
18
+ def printAmount (self ):
19
+ print ("my amount is" , self .amount )
20
+ print (self .amount )
21
+
22
+
23
+ class BankAccount :
24
+
25
+ def __init__ (self ):
26
+ self .accounts = [Account () for i in np .arange (1000 )]
27
+
28
+ def putMoney (self , account , deposit ):
29
+ self .accounts [account ].putMoney (deposit )
30
+
31
+ def takeMoney (self , account , withdrawal ):
32
+ self .accounts [account ].takeMoney (withdrawal )
33
+
34
+ def printAmount (self , account ):
35
+ self .accounts [account ].printAmount ()
36
+
37
+ a = BankAccount ()
38
+ a .putMoney (5 , 100 )
39
+ a .printAmount (5 )
You can’t perform that action at this time.
0 commit comments