Classes and 'self'
Hello,
I have been following a lecture on creating classes in Python and I tried to run the same code as in the solution to the exercise, but it did not want to work.
So the code beings with:
class BankAccount(object):
def _init_(self, balance = 0):
self.balance = balance
<rest of the code>
And when I try to run:
my_bank = BankAccount(300)
===> BankAccount() takes no arguments.
Could someone help me with that? I am pretty sure I copied precisely the same code as in the ex. solutions...
1 answers ( 0 marked as helpful)
Hi Aleksandra,
could you please provide a screenshot with your entire class definition, as well as the code and the following error message?
Thank you!
Best,
Eli