. Advertisement .
..3..
. Advertisement .
..4..
When I running my program, I encounter ”taberror: inconsistent use of tabs and spaces in indentation in python” error:
a = int(input("Please enter an integer A: "))
b = int(input("Please enter an integer B: "))
if b > a:
print("B is greater than A")
elif a == b:
print("A and B are equal")
else:
print("A is greater than B")
Output:
TabError: inconsistent use of tabs and spaces in indentation
How can it be solved?
The cause: This occurs because the code has all the tabs and spaces mixed up.
The solution: To correct this, make sure that the code is indented evenly. Another option to repair this mistake is to press Ctrl + A to select the full code. Then go to the Format settings in IDLE. Untabify the region by clicking on it.
You can adding given below line at the beginning of code: