The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Classes and ‘self’

Classes and ‘self’

0
Votes
1
Answer

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 Answer

365 Team
0
Votes

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