I’m new to Python and it just confounds me with Indentation errors. In the following images, why does the first one work and the second one give me an indentation error?
Works:

Doesn’t work: (Notice extra tree-expander that pops up in Notepad++)

Error:
File ".\sigma.py", line 14
for val in vs:
^
IndentationError: unexpected indent
I’m using Notepad++ and there are no spaces/tabs issues anywhere. Also, tried it out on the Python console typing it in exactly the same way in the 2nd image. It works fine. I’m guessing there’s a very logical explanation to this, but coming from a strong-typed background (>5 years in Java), this feels like an unnecessary error.
You are mixing tabs and spaces. Don’t do this, it creates inconsistent indentation problems.
Run your script through the tab checker:
and fix any and all tabs (replace with spaces), then configure your editor to only use spaces.
For Notepad++, see: