error in defining class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

error in defining class

It says TypeError: object takes no parameters

9th Nov 2017, 12:13 PM
priyam mehta
priyam mehta - avatar
3 Answers
+ 1
Provide the code?
9th Nov 2017, 12:50 PM
Sapphire
+ 1
There is a number of issues with the example you provided, numbers below are by line: 1) class is case-sensitive, so you must use the lower case 2) Defining a function is case sensitive as well, you must use a lowercase 'd', not capital. Also you must use two underscores on each side of init (This is why you get the Object takes no paramaters error, specifically). 3-4) same issue, self is lowercase Here's an example code: https://code.sololearn.com/cEnYh5M2l49y
9th Nov 2017, 2:39 PM
Sapphire
0
It’s actually one I used to try Class mydogs: Def _init_(self,color,name): Self.color=color Self.name=name Dog1=mydogs(“brown”,”tom”) Then comes the error...
9th Nov 2017, 2:01 PM
priyam mehta
priyam mehta - avatar