Home > Software engineering >  How do I fix indentation error in Jupyter when there are no indentations?
How do I fix indentation error in Jupyter when there are no indentations?

Time:11-21

I am trying to learn polymorphism. Everytime I try to create a class, it gives me the indent error when I haven't even added indentations yet.

enter image description here

I have tried restarting Jupytrer and my pc, no luck. I tried using another notebook but still no luck.

CodePudding user response:

As the error shows, it is expecting an indented block after the class.

So add a statement in there, example:

class Animal():
    pass

CodePudding user response:

You should understand the basics of classes in python for this. It is working fine, the only thing is that your code is incomplete. After you declare a class, it is simply expecting a class body.

  • Related