Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Why I am getting this error in the code ''int' object is not callable'. Thanks for help!

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 493
    Answer it

    Here is my Code: 

    class Account:
      def __init__(self, owner, balance, deposit, withdraw):
        self.owner=owner
        self.balance=balance
        self.deposit=deposit
        self.withdraw=withdraw
       
      def __str__(self):
        return f'Account Owner{self.owner} Account Balance {self.balance}'
       
      def Deposit(self,deposit):
        self.balance+=self.deposit
        print ('Deposit Accepted')
     
      def Withdraw(self,withdraw):
        self.balance-=withdraw
        while self.withdraw>=self.balance:
          print ('Funds Unavailable')
        else:
          print ('Withdrawal Accepted')
    
    acct1 = Account('Jose',100,0,0)
    
    acct1.deposit(50)
    Below is the error:
    
    TypeError                                 Traceback (most recent call last)
    <ipython-input-56-a52dcc476376> in <module>
    ----> 1 acct1.withdraw(75)
    
    TypeError: 'int' object is not callable

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: