+ 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)

7th Jan 2017, 1:41 AM
Nate
6 Antworten
+ 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 ^^
7th Jan 2017, 2:12 AM
visph
visph - avatar
+ 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
7th Jan 2017, 1:56 AM
Don
Don - avatar
+ 1
It said invalid syantax on health.
7th Jan 2017, 1:55 AM
Nate
+ 1
Well it still says invalid on the same spot so can you please give an example
7th Jan 2017, 2:12 AM
Nate
0
Did you make sure everything is linked with variables correctly?
7th Jan 2017, 1:43 AM
spameggseggseggs
0
chararacter ':' missing on __init__ definition + check the indentation is correct.
7th Jan 2017, 1:59 AM
ifl
ifl - avatar