Returns an error

Question:

  File "main.py", line 4
    print()
           ^
IndentationError: unindent does not match any outer indentation level

Replit Profile: https://replit.com/@KonstantinAvie2

Hey @KonstantinAvie2 could you share a link to your Repl so it’s easier for us to help you?

1 Like
def hi():
	def hi2():
		def hi3():
    print()

The error is that the print function does not have the right indentation. Keep in mind these functions are only for example. Make sure to intend right after the indentation of the last function. If the print is supposed to be in the function “hi” then move it up right because “hi2” is defined.

Corrected should look like this:

def hi():
	def hi2():
		def hi3():
            print()

Or this if you need it in the first function:

def hi():
    print()
	def hi2():
		def hi3():

Like firepup said, you should also provide a link to the REPL so I know what your code actually looks like. Just sharing the REPL profile won’t help much.

this is why I hate Python… the indentations…

2 Likes

Actually it seems that I’m getting an error when using the first solution.

But don’t most languages require indents too?

Nope, they usually use curly brackets and semicolons: indentation is purely stylistic and optional

1 Like