Python objects


#1

have idea what wrong here with this?

class BankAccount(object):
    #no implementation
  def withdraw(self, amount):
   #no implementation
  def deposite(self, amount):
    #no implementation
class SavingAccount = BankAccount():
  def __init__(self, withdraw, deposite, balance):
    self.balance = 500
    self.withdraw = withdraw
    self.deposite = deposite
    self.balance = balance
    
  def deposite(self, amount):
    if (self.deposite - amount < 0):
      return "Invalid deposite amount"
    else:
      self.balance += amount
      return self.balance
      
  def withdraw(self, amount):
    self.balance -= amount
    if (self.balance <= 500):
      return "Cannot withdraw beyond the minimum account balance"
    elif (self.balance > amount):
      return "Cannot withdraw beyond the current balance acount"
    elif (self.withdraw - amount < 0): 
      return "Invalid withdrawal amount"
      
class CurrentAccount = BankAccount():
  def __init__(self, withdraw, deposite, balance = 0):
    self.balance = balance
def deposite(self, amount):
    self.balance = amount
    return self.balance
    if (self.deposite - amount < 0):
      return "Invalid depoiste amount"
      
  def withdraw(self, amount):
    self.balance -= amount
    return self.balance
    if (self.withdraw - amount < 0):
      return "Invalid withdraw amount"
    elif (self.balance > amount):
      return "cannot withdraw beyond the current account balance"

Please explain this code
#2

You might explain why you think there's something wrong - be specific about what you want to know


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.