Search code examples
pythonclasssyntax-error

How do I fix indentation error when creating a class in Python?


Every time I try to create a class, it gives me the IndentationError when I haven't even added indentations yet.

Error Screenshot

I have tried restarting Jupyter and my PC and there is no luck. I have also tried using another notebook but still face the error.


Solution

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

    So add a statement in there, example:

    class Animal():
        pass