비슷한 질문을 보았지만 아직 이해할 수 없었습니다. 나는 어딘가에서 아주 어리석은 실수를하고 있다는 것을 확신하지만 나는 그것을 찾지 못하는 것 같습니다.왜 내가 TypeError를 얻는 지 혼란스러워합니다. 'int'객체를 호출 할 수 없습니다.
이 코드의 경우.
class BankAccount:
def __init__(self, initial_balance):
self.balance = initial_balance
def deposit(self, amount):
self.deposit = amount
self.balance = self.balance + self.deposit
def withdraw(self, amount):
self.withdraw = amount
self.balance = self.balance - self.withdraw
self.fee = 5
self.total_fees = 0
if self.balance < 0:
self.balance = self.balance - self.fee
self.total_fees += self.fee
def get_balance(self):
current_balance = self.balance
return current_balance
def get_fees(self):
return self.total_fees
는 내가 추가 호출이이 오류가 발생합니다
my_account = BankAccount(10)
my_account.withdraw(15)
my_account.withdraw(15)
my_account.deposit(20)
print my_account.get_balance(), my_account.get_fees()
철회 할 경우 나, 그러나이
my_account = BankAccount(10)
my_account.withdraw(15)
my_account.deposit(20)
print my_account.get_balance(), my_account.get_fees()
를 실행할 때 코드 모든 것이 잘 작동 실행하면.
TypeError: 'int' object is not callable
퇴장 전화를 추가로 신청해야만 정상적으로 작동하는 이유를 알 수 없습니다. 도와주세요.