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

Python

Take Quiz: __init__() takes 1 positional argument but 3 were given

I'm working on the Quiz game and I keep getting this response. I'm copying everything the instructor is doing to a T, yet I still get this error. Can someone tell me what I am doing wrong?

My code: https://w.trhou.se/ki9befgfph

when i went through your code, i noticed questions.py is where the error is. check your Add's init() function where you are sending self, num1 and num2 as 3 arguments, the error says you should only send 1 argument. work around that area, you should figure out the problem. Hope that helps. cheers!

1 Answer

Steven Parker
Steven Parker
229,980 Points

Look at class "Multiply" starting on line 11. Notice that:

  • it is missing a reference to the class it should inherit from ("Question")
  • it has an "__init__" method defined inside another "__init__" method
  • the first method has one argument but the inner one has 3

Hint: try using the "Add" method as a model and make the "Multiply" method look more like it.