[python] Python: "Indentation Error: unindent does not match any outer indentation level"

I had a similar problem with IndentationError in PyCharm.

I could not find any tabs in my code, but once I deleted code AFTER the line with the IndentationError, all was well.

I suspect that you had a tab in the following line: sex = sex if not sex == 2 else random.randint(0,1)