+ 3
def not working?
So i have a code here: def __init__(programmer, self, web): self.programmer = programmer self.web = web And it wont work.
15 Respostas
+ 4
H4CK3R😺😺C4t😺😺 Send full code and the traceback
+ 3
Yes.
+ 3
Enclose the code in a class and see it work
+ 2
That is the full code ⏩ Prometheus ⏪
+ 2
H4CK3R😺😺C4t😺😺 Not in a class?
+ 2
Sure Ok i will try it.
+ 2
It does not work
it says:
def __init__(programmer, self, web):
___^___
Expected Indetation block
+ 2
⏩ Prometheus ⏪ Thanks!
+ 1
「HAPPY TO HELP」 Thanks for the Answer!
+ 1
Yeah.
So the corrected code should look like:
class Thing:
def __init__(self,programmer,web):
self.programmer=programmer
self.web=web
+ 1
You're welcome!
+ 1
「HAPPY TO HELP」 I just Saw that you are close to platnuim!
congrats to almost being there!
+ 1
No problem 「HAPPY TO HELP」 i am happy to watch youre level + XP
+ 1
You most put "self" to first parameter.
def __init__ (self, programmer, web):
self.programmer = programmer
And.....
Remember "self" is not a keyword.
in fact first parameter in __init__ considered as a "self"
!
0
Mehran sanea Should have a class before that too