AttributeError HELP!

Posted by C0d3r on Stack Overflow See other posts from Stack Overflow or by C0d3r
Published on 2010-06-12T00:47:03Z Indexed on 2010/06/12 0:52 UTC
Read the original article Hit count: 376

Filed under:
  class Account:
  def __init__(self, initial):
      self.balance = initial
      def deposit(self, amt):
          self.balance = self.balance + amt
      def withdraw(self,amt):
          self.balance = self.balance - amt
      def getbalance(self):
          return self.balance

a = Account(1000.00)
a.deposit(550.23)
a.deposit(100)
a.withdraw(50)

print a.getbalance()

I get this error when I run this code.. AttributeError: Account instance has no attribute 'deposit'

© Stack Overflow or respective owner

Related posts about python