Error message
File "C:/python/xxxx/xxx.py", line 12, in <module>
d=Dog('small dog')
TypeError: object() takes no parameters
Source Code
class Dog:
name='samll dog'
def __inti__(self,name):
self.name=name
d=Dog('small dog')
e=Dog('very small dog')
print(type(d))
print(type(e))
print(d.name)
print(e.name)
Problem
Wrong spelling mistake, it should be __init__ but not __inti__ :
class Dog:
name='samll dog'
def __init__(self,name):
self.name=name
d=Dog('small dog')
e=Dog('very small dog')
print(type(d))
print(type(e))
print(d.name)
print(e.name)
Reference
https://stackoverflow.com/questions/23176597/python-object-takes-no-parameters-error
I'm a long-serving digital marketing professional and full-service as a social media marketing manager. I'm offering services at a competitively low cost. I have experience in keyword research, Article writing or Rewriting, Guest posting, B2B Lead Generation , Data Entry ,link building, web 2.0 backlink ,
ReplyDelete. I have 5 years of experience in the field and are assured of delivering High Quality and manual work. I have my own site name as AbidhTech. My Blog site also here. This is a Bangla deshi Science club site .