Python IndentationError: unindent does not match any outer indentation level
33,323
Solution 1
Change your indentation and ensure it's consistent ( just use spaces or just use tabs, don't mix both ):
if buildings == 1:
workpower -= 3
if workpower >= 0:
farmplace1 = int(input("where do you want it?"))
farmplace2 = int(input("where do you want it?"))
board[farmplace1][farmplace2] = "F"
my_dict['d'] -= 3
Solution 2
Check if you use regular whitespaces for all your indents, the most likely you have tab or another space character like that instead of the whitespace.
Mixing space characters may lead to nice visual indents but bad for the interpreter.
Author by
Admin
Updated on July 09, 2022Comments
-
Admin almost 2 years
I am trying to update a dictionary value in Python. I'm trying to update a value in the dict by subtracting 3 from the value.
if buildings == 1: workpower -= 3 if workpower >= 0: farmplace1 = int(input("where do you want it?")) farmplace2 = int(input("where do you want it?")) board[farmplace1][farmplace2] = "F" my_dict['d'] -= 3;
I get the following error
IndentationError: unindent does not match any outer indentation level
What is wrong with the code?