NameError: name 'DQ' is not defined

class NewList(DQ):
    def first_method():

I did not expect any error

An error bellow occurs

NameError                                 Traceback (most recent call last)
<ipython-input-32-3eff785dbe74> in <module>
----> 1 class NewList(DQ):
      2     def first_method():
      3         print("hello")
      5 instance = NewList()

NameError: name 'DQ' is not defined

I’m following Dataquest Mission Object-Oriented Python testing the code on Jupyter installed on my PC
When using directly on dataquest platform i receive no error.

1 Like

The DQ should be used only in the dataquest platform for answer checking purposes. In the mission it is explained:

Usually, we’d define a class without anything in the parentheses, like this:

class MyClass():

In the rest of this mission, when you define a class in the code exercise, you’ll need to put DQ inside the parentheses:

class MyClass(DQ):

This makes the class inherit some special logic that allows our answer-checking system to work and give you feedback. We’ll remind you each time we tell you to define a new class so you don’t forget!

1 Like

Well noted thank you.



You’re welcome! If it solved your problem, would you mind marking the answer as solution? Thank you!

1 Like