Re: assignment in a for loop



Thank you for your reply.


1) Is what I wrote above (minimally) correct?

Correct for what? You can tell if it's *syntactically* correct by
simply running it.

As for any other "correct", define that. Does it do what you want it
to do?

I was referring to my attempted explanation, not the code snippet.

[...]

What's preventing the use of list comprehensions?

new_list = [x+1 for x in old_list]

Suppose I want to do anything as trivial as modify the values of the
list members _and_ print their new values. List comprehensions must not
contain statements, I think.


Mack

.