IndentationError:at second char.lower()?

Viewed 38

Ok , so for some days i continously get this error and i make simple python problems and this still comes out of nowhere i really dont understand what i m wrong with

def counterpartCharCode(char):
    a = char.upper()
    b = char.lower()
    if char == a:
        return ord(b)
    else:
        return ord(a)

print(counterpartCharCode("A"))

File "e:/salut.py", line 3 b = char.lower() ^ IndentationError: unindent does not match any outer indentation level

1 Answers

You have mixed tabs and spaces, a mortal sin. Editing your code I see

SSSTa = char.upper()
SSSSb = char.lower()

where S is space and T is tab.

Related