Inconsistent use of tabs and spaces in indentation

Assuming you have a "good" IDE, it's best to set the tab key to make 4 spaces instead of a "tab", that way you have less problems, and it's good practice, for when you will work with other people.


It means you have mixed up spaces and tabs in the indentation. You have to fix that to be consistent with either tabs or spaces.


If you look carefully at the lines

    temp=dna1[i:i+len2]
    if temp == dna2:

in your code, you will see that the "space" at the beginning of each line is "constructed" differently. In one case it uses tabs and in the other spaces, or, if both have tabs and spaces then they are used in different combinations.

You can examine this by placing your cursor at the beginning of each line and using the right-arrow key to "walk" your way through the characters. You'll see that the cursor moves differently on each line.

To fix, delete the tabs and spaces at the beginning of each line and re-insert them with the same characters on each line.

To avoid in the future, train yourself to use only the tab key OR the space key to indent, and consider setting your editor to automatically convert tabs to spaces.