On the contrary, running the two lines together does not imply any problem.
But if letters is defined/assigned in the first line, then why running the two lines separate create a problem?
Thanks and sorry in advance if it sounds a “stupid question”.
Thanks for the reply.
I mean literally run only the first line of code
letters = [“a”, “b”, “c”]
and then run only
print(letters)
I may be biased from R where if I firstly define letters (run only first line) and then run only the print command, it shows me the desired output.
Hope it is clearer now.
Yes, but what do you mean by “only run”. Are you commenting out the other line? Are you using some special “run selected” function? I do not think any state is retained between runs if that is the case.
If you ran the lines one at a time in the Python REPL it should work just fine.
No, without commenting out the other line.
Just selecting the first and execute (control+otion+n) and then doing the same with the second one.
I just realize that if I run it in the interactive window in VS code, it works as expected. So it may be the way of execution (shift+enter) vs (control+otion+n)?