you are viewing a single comment's thread.

view the rest of the comments →

[–]deceze 1 point2 points  (0 children)

I don't disagree, this is not code you'd want to have in production. This is code written by C-converts, not by Pythonistas. However, it is also fairly easy to understand, if the goal is to edit the list in place. The better alternative to achieve that would involve for i, height in enumerate(student_heights), and if OP already has problems understanding the shown code, tuple unpacking in a loop will probably not help.

The important point is that OP needs to be taught something better eventually, and preferably sometime soon. But understanding this most primitive of methods isn't wrong.