mardi 12 mars 2019

Merging two incomparable sorted lists of elements keeping their relative ordering in python-3

I have two ordered lists that their elements are incomparable, like:

l1 = [1, 2, 3, 4]  
l2 = [obj1, obj2, obj3]  

I want to merge them randomly into one list with keeping their relative ordering, like:

ml = [1, 2, obj1, obj2, 3, obj3, 4] or ml = [obj1, 1, 2, 3, obj2, obj3, 4]  

I would appreciate if anyone help me.




Aucun commentaire:

Enregistrer un commentaire