Ask coding questions

← Back to all posts
Day-7-Hangman-5-Start
KenR (0)

Why do I get the error message.?
File "main.py", line 43
lives -= 1
^
TabError: inconsistent use of tabs and spaces in indentation

Voters
KenR (0)
Comments
hotnewtop
robowolf (446)

First the lives-=1 is not in the if statement. If this was supposed to be happen then on line 43 the if statement needs to be aligned with the first one.

KenR (0)

@robowolf
It is in the if statement. If I get the code from another source, it runs OK. This message shows up whenever I modify the code by entering another line in the if
statement.

robowolf (446)

@KenR I was referring to line 43. If it is in the if statement then you need to indent it to be aligned with line 42.

KenR (0)

@robowolf
You are right! But the code as shown here is not how it was written in the original.

robowolf (446)

@KenR Oh! Are you saying you copy pasted the code from somewhere and the indentation changed? If so, then that's a bug with replit. Just fix the indentation and then everything else should work.