+ 2
Why does this say invalid sayntax on line two class goblin: def __init__(self,health) self.health=health gragnack=goblin(10,200) print(gragnack)
6 Réponses
+ 5
In addition to correct indentation, you need to place a double dot at the end of the line "def __init(self, health)", as at the first line ^^
+ 2
I would say invalid syntax too. You're passing in one too many arguments into the constructor. Self is implied when you're creating an instance.
Also you're forgetting the colon after the definition of the constructor. Then you're supposed to indent the block underneath the constructor as well.
def __init__(self, heath):
self.health = health
+ 1
It said invalid syantax on health.
+ 1
Well it still says invalid on the same spot so can you please give an example
0
Did you make sure everything is linked with variables correctly?
0
chararacter ':' missing on __init__ definition
+ check the indentation is correct.