Back

Explore Courses Blog Tutorials Interview Questions
0 votes
4 views
in Python by (47.6k points)

How do I rectify the error "unexpected indent" in python?

1 Answer

0 votes
by (106k points)

To get rid of the unexpected indent in Python, the spacing is very important, this gives the structure of your code blocks. This error happens when you mess up your code structure, for example like this :

def test_function() : 

if 5 > 3 : 

print("hello")

You may also have a mix of tabs and spaces in your file.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Feb 10, 2021 in Python by ashely (50.2k points)
0 votes
1 answer
asked Feb 17, 2021 in Python by laddulakshana (16.4k points)
0 votes
0 answers

Browse Categories

...