0

I am new to Python 3.0 and was wondering how I can just unpack the first tuple '(1,2,3)' from the list below using a 'for' loop. Below is my code and what I tried to do

mylist = [(1,2,3),(4,5,6),(7,8,9)]

for (a,b,c), (d,e,f), (g,h,i) in mylist: print(a,b,c)

TypeError Traceback (most recent call last) in ----> 1 for (a,b,c), (d,e,f), (g,h,i) in mylist: 2 print(a,b,c) 3 # Reorganizing the structure of the data set

TypeError: cannot unpack non-iterable int object

Ayaan M
  • 1
  • 1

0 Answers0