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

30th Oct 2018, 2:49 AM
Potato Hacker
Potato Hacker - avatar
15 Respostas
+ 4
H4CK3R😺😺C4t😺😺 Send full code and the traceback
30th Oct 2018, 2:55 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Yes.
30th Oct 2018, 3:27 AM
Potato Hacker
Potato Hacker - avatar
+ 3
Enclose the code in a class and see it work
30th Oct 2018, 3:28 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
That is the full code ⏩ Prometheus ⏪
30th Oct 2018, 3:25 AM
Potato Hacker
Potato Hacker - avatar
+ 2
30th Oct 2018, 3:26 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Sure Ok i will try it.
30th Oct 2018, 3:29 AM
Potato Hacker
Potato Hacker - avatar
+ 2
It does not work it says: def __init__(programmer, self, web): ___^___ Expected Indetation block
30th Oct 2018, 3:32 AM
Potato Hacker
Potato Hacker - avatar
30th Oct 2018, 3:35 AM
Potato Hacker
Potato Hacker - avatar
30th Oct 2018, 3:33 AM
Potato Hacker
Potato Hacker - avatar
+ 1
Yeah. So the corrected code should look like: class Thing: def __init__(self,programmer,web): self.programmer=programmer self.web=web
30th Oct 2018, 3:34 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
You're welcome!
30th Oct 2018, 3:35 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
「HAPPY TO HELP」 I just Saw that you are close to platnuim! congrats to almost being there!
30th Oct 2018, 3:41 AM
Potato Hacker
Potato Hacker - avatar
+ 1
No problem 「HAPPY TO HELP」 i am happy to watch youre level + XP
30th Oct 2018, 3:47 AM
Potato Hacker
Potato Hacker - avatar
+ 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" !
30th Oct 2018, 8:37 PM
Mehran sanea
Mehran sanea - avatar
0
Mehran sanea Should have a class before that too
30th Oct 2018, 9:05 PM
I Am Arthur
I Am Arthur - avatar