I have gone through ZIP function in python.
I copied this python code and did hands-on.
list1 = ["c", "b", "d", "a"]
list2 = [2, 3, 1, 4]
zipped_lists = zip(list1, list2)
print('L')
print(zipped_lists)
#[print(ZipDa) for ZipDa in zipped_lists]
sorted_pairs = sorted(zipped_lists)
print('S')
print(sorted_pairs)
tuples = zip(*sorted_pairs)
print('t')
print(tuples)
list1, list2 = [list(tuple) for tuple in tuples]
print(list1)
print(list2)
and got output as
L
<zip object at 0x000002485D55B000>
S
[('a', 4), ('b', 3), ('c', 2), ('d', 1)]
t
<zip object at 0x000002485D58BCC0>
['a', 'b', 'c', 'd']
[4, 3, 2, 1]
When i uncomment the line [print(ZipDa) for ZipDa in zipped_lists] i see the data in Zipped_List. but the sorted(zipped_lists) received empty list. Please refer below output.
L
<zip object at 0x000002026736B000>
('c', 2)
('b', 3)
('d', 1)
('a', 4)
S
[]
t
<zip object at 0x00000202673B1540>
Can you please share why after looping iterator send empty list ?