Where did i get it wrong ? ( Object-oriented programming -> Classes in py ) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Where did i get it wrong ? ( Object-oriented programming -> Classes in py )

class Me: def _init_(self, name, complexion): self.name = name self.complexion = complexion def TOEFL(self): print("You've failed") class Loophole: def TOEFL(self): print("You've succeeded") me = Me("VH","Fair") me.TOEFL() Additional references would be appreciated Thanks

21st Jun 2018, 7:21 AM
Hồng Vĩ
Hồng Vĩ - avatar
4 Answers
+ 8
Hồng Vĩ thanks for pasting the code :) So the problem is with the 'init' . It should have __(double underscores) before and after it. Like ~ __init__(self, name, complexion) Your code had only one ~ _init_(self, name, complexion) Here's the corrected code for you https://code.sololearn.com/cMf1erb6B68f/?ref=app
21st Jun 2018, 8:26 AM
Nikhil
Nikhil - avatar
+ 13
Please elaborate more on your question. As in it's current form, it's not possible to answer without seeing your code
21st Jun 2018, 7:35 AM
Nikhil
Nikhil - avatar
+ 3
wow
21st Jun 2018, 8:29 AM
Hồng Vĩ
Hồng Vĩ - avatar
+ 2
sorry I'll just paste the whole code on the question
21st Jun 2018, 7:44 AM
Hồng Vĩ
Hồng Vĩ - avatar