I started learning python few weeks ago(with no previous knowledge in programming), and went onto the following problem related to unpacking of sequences, which confuses me a lot.
For some reason when I try this:
for b, c in [1,2]:
print b,c
I am getting an error message:
TypeError: 'int' object is not iterable
The same happens when I try to replace the list with a tuple (1,2)
But when I try the same thing, just with a tuple inside of list:
for b, c in [(1,2)]:
print b,c
it works - I get:
1 2
Why is that?
Thank you.
btw I am using Python 2.7