这个python代码有问题

时间:2016-06-10 07:56:55

标签: python python-3.3

我收到此错误,我已经尝试通过堆栈流可用的帖子我仍然没有得到解决方案。这是代码

class  BankAccount:
    def  _init_(self,balance):
        self.balance  =  balance
    def  deposit(self,amount):
        self.balance  +=  amount
        return  self.balance
    def  withdraw(self,amount):
        if  amount>self.balance:
            print  "invalid  transaction"
        else:
            self.balance  -=  amount
            return  self.balance
class  MinimumBalanceAcccount(BankAccount):

//这是我得到的错误:IndentationError: expected an indented block

1 个答案:

答案 0 :(得分:0)

其缩进错误。
完成类定义。

class  BankAccount:
  def  _init_(self,balance):
    self.balance  =  balance
  def  deposit(self,amount):
    self.balance  +=  amount
    return  self.balance
  def  withdraw(self,amount):
    if  amount>self.balance:
        print  "invalid  transaction"
    else:
        self.balance  -=  amount
        return  self.balance

class  MinimumBalanceAcccount(BankAccount):
  def __init__(self):
    print "working"