IndentationError: unexpected indent
why does my repl give an error even though its fine?
As the error message indicates, you have an unexpected indent error . This error occurs when a statement is unnecessarily indented or its indentation does not match the indentation of former statements in the same block. Python not only insists on indentation, it insists on consistent indentation . You are free to choose the number of spaces of indentation to use, but you then need to stick with it. If you indent one line by 4 spaces, but then indent the next by 2 (or 5, or 10, or ...), you'll get this error.
However, by default, mixing tabs and spaces is still allowed in Python 2 , but it is highly recommended not to use this "feature". Python 3 disallows mixing the use of tabs and spaces for indentation. Replacing tabs with 4 spaces is the recommended approach for writing Python code .