-2

Learn to Program: Crafting Quality Code

Screenshot

enter image description here This is a video lecture from Coursera Learn to Program Crafting Quality Code Course. So there is a quiz during the video.

class MyInt(int):
    # some code there

They gave 4 answers where I need to choose a right one. I've choose my answers one by one but finally they say that right is absolutely wrong answer.

int is a subclass of MyInt

This question Python: How do I make a subclass from a superclass? gives me absolutely right confirmation that I'am right.

Where is the truth?

Community
  • 1
  • 1

2 Answers2

1

There must be something wrong with the quiz, the code as written in the question is declaring that MyInt is a subclass of int (or equivalently: that int is the superclass of MyInt), no the other way around.

Óscar López
  • 225,348
  • 35
  • 301
  • 374
0

If you inherit from a class, that class is the super-class. In the example int is the super (or base) class and MyInt is the subclass. They're wrong, just as you suspected. ;-)

siebz0r
  • 16,849
  • 11
  • 58
  • 104
  • Thanks. # I was not suspecting. :) I'm just boring to watch the videos only to get a certificate. I prefer to learn the core of the language or a technology on their main site. – user1667218 Apr 11 '13 at 16:53