Why does the below list comprehension give an error? What am I missing?
a = [
[(1, 2), (11, 22), (111, 222)],
[(3, 4), (33, 44), (333, 444)],
[(5, 6), (55, 66), (555, 666)]
]
b = [k for k in j for j in i for i in a]
print(sorted(b))
I know there are more elegant/readable solutions, but this is for my own understanding.
Error: TypeError: 'int' object is not iterable
Desired Output: [1, 2, 3, 4, 5, 6, 11, 22, 33, 44, 55, 66, 111, 222, 333, 444, 555, 666]