Skip to content

Commit 76a0e06

Browse files
committed
Refactored classes file
1 parent d869557 commit 76a0e06

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

snippets/classes.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from __future__ import print_function
21
import numpy as np
32

43

@@ -7,15 +6,15 @@ class Account:
76
def __init__(self):
87
self.amount = 0
98

10-
def putMoney(self, deposit):
9+
def put_money(self, deposit):
1110
print("my amount is", self.amount)
1211
self.amount += deposit
1312
print("my amount is", self.amount)
1413

15-
def takeMoney(self, withdrawal):
14+
def take_money(self, withdrawal):
1615
self.amount -= withdrawal
1716

18-
def printAmount(self):
17+
def print_amount(self):
1918
print("my amount is", self.amount)
2019
print(self.amount)
2120

@@ -25,15 +24,15 @@ class BankAccount:
2524
def __init__(self):
2625
self.accounts = [Account() for i in np.arange(1000)]
2726

28-
def putMoney(self, account, deposit):
27+
def put_money(self, account, deposit):
2928
self.accounts[account].putMoney(deposit)
3029

31-
def takeMoney(self, account, withdrawal):
30+
def take_money(self, account, withdrawal):
3231
self.accounts[account].takeMoney(withdrawal)
3332

34-
def printAmount(self, account):
33+
def print_amount(self, account):
3534
self.accounts[account].printAmount()
3635

3736
a = BankAccount()
38-
a.putMoney(5, 100)
39-
a.printAmount(5)
37+
a.put_money(5, 100)
38+
a.print_amount(5)

0 commit comments

Comments
 (0)