Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Everett Coombes
2,585 PointsWhat am I missing here? I'm pretty certain my code matches Kenneth's code, yet I am getting an error
At 2:15 into the video, Kenneth runs the interpreter to import Add from questions, and then creates a variable that call on the Add() class. However when I try to run the script
from questions import Add
add1 = Add(5, 7)
i get an error that says
TypeError: object() takes no parameters
class Question:
answer = None
text = None
class Add(Question):
def __intit__(self, num1, num2):
self.text = '{} + {}'.format(num1, num2)
self.answer = num1 + num2
class Multiply(Question):
def __intit__(self, num1, num2):
self.text = '{} * {}'.format(num1, num2)
self.answer = num1 * num2
2 Answers
Chris Freeman
Treehouse Moderator 68,468 PointsYour code is very close. The reason Add takes no parameters, is there is no __init__() method to run due to the typo in the method name. Change __intit__ to __init__ and it should work.
Everett Coombes
2,585 PointsI just googled diff. I was not aware such a thing existed, yet I am not surprised.
Thank you again!
Everett Coombes
2,585 PointsEverett Coombes
2,585 PointsWow....time for another cup of coffee I think. I've been staring at this for over half an hour, scrutinizing between my code and Kenneths, and failed to see any errors.
Thank you so much for your help Chris!
Chris Freeman
Treehouse Moderator 68,468 PointsChris Freeman
Treehouse Moderator 68,468 PointsNo worries. There have been times I've had run
diffon two versions of "matching" code to find what my tired eyes couldn't see.