Why am i getting 'indentationerror: unexpected indent' in python?

Example:

def my_function():
    x = 5
   y = 6
return x + y

In Python, indentation is crucial for defining block structures. This error indicates inconsistent indentation.

Solution:

Ensure consistent indentation throughout the code.


def my_function():
    x = 5
    y = 6
    return x + y

Beginner's Guide to Python