NameError: name 'vlaue' is not defined

When using a python custom class, a class is defined, but when calling, the following error occurs:

>>> class Athlete:

def __init__(self, value=0):

self.thing = vlaue

def how_big(self):

return(len(self.thing))

>>> d = Athlete("Holy Grail")

Traceback (most recent call last):

  File "<pyshell#7>", line 1, in <module>

    d = Athlete("Holy Grail")

  File "<pyshell#6>", line 3, in __init__

    self.thing = vlaue

NameError: name 'vlaue' is not defined

 

After careful inspection, it is found that  vlaue is wrong, and there is no problem in changing it to value. Be careful!

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326849878&siteId=291194637
Recommended