- 1

What is wrong with my syntax on line 3?

def __init__ (self,name,balance,acctnum):I feel it is rejecting the syntax because my code is huge. cos I checked on the site. and it looked ok. but it is raising flimsy issues with my code. issues that cannot be adjusted. the code is so large that I am yet to load it on this Q and A platform class BankAccount: def __init__ (self,name,number,balance): self.name=name self.number=number self.balance=balance class SavingsAccount(BankAccount): def __init__(self, balance=500): assert(self.balance>500), "minimum balance is 500" def deposit (self, amount): if amount<0: return "Invalid deposit amount" self.balance+=amount return self.balance def withdraw(self,amount): Assert (self.balance>amount), "cannot withdraw" if amount<0: return "Invalid amount" self.balance-=amount return self.balance class currentaccount(BankAccount): def __init__(self,balance=0): def deposit (self, amount): if amount<0: return ("Invalid deposit amount") self.balance+=amount return self.balance def withdrawal (self, amount): assert (self.balance > amount),"cannot withdraw beyond the current account balance" if amount<0: return "Invalid amount" self.balance-=amount return self.balance

4th Sep 2016, 10:45 PM
Dan-Awoh Emmanuel
Dan-Awoh Emmanuel - avatar
4 Antworten
0
Try to delete the line self.name = name and re-write it. sometimes copy paste csuses issues like that.
6th Sep 2016, 6:57 AM
Abdelkader Ait Assou
Abdelkader Ait Assou - avatar
0
you must have 4 space (or 1 tab) after the ":" at line 2 I think you have only 2 spaces... maybe? remember to have alway 4 spaces after the :
8th Sep 2016, 6:18 PM
Giovanni Gatto
Giovanni Gatto - avatar
0
hmmm true. I copied and pasted it. no wonder
8th Sep 2016, 7:11 PM
Dan-Awoh Emmanuel
Dan-Awoh Emmanuel - avatar
0
if you are writing the code in notepadpp and then loading with IDLE then you get indented errors. delete the free space next to your class def and free space at the beginning in line 3.once deleted free space then just use tab..no space bar usage
12th Sep 2016, 4:10 AM
hussain banoth
hussain banoth - avatar