Format two List Comparison

Hi ,

Someone barged into my ongoing Discussion . So i had to start a new Discussion.

If my items of lists are not fixed on both the list , how do i compare them:

Now i have one more issue on the LIST comparison:
If the numbers of items in list is not equal is there way to compare:

suppose my lists are:
list1
“dp-steps-common-3.0.12”,
“iam-python-common-1.0.1”,
“iam-service-default-3.1.37”
list2:
“dp-steps-common-3.0.15-1911280809_d103a.noarch”,
“iam-service-default-3.1.37-1911141021_63e48.noarch”

  • name: If the List comparision is not equal
    debug:
    msg: “{{ item.0 }} is not equal to {{ item.1 }}”
    loop: “{{ list1|sort|zip(list2|sort)|list }}”
    when: item.0.split(‘-’)[-1] is not version(item.1.split(‘-’)[-2])

If i execute the playbook,all elements on list1 are compared with all elements on list2.

I want my o/p should be as follows:
dp-steps-common-3.0.12 not equal to dp-steps-common-3.0.15-1911280809_d103a.noarch

iam-service-default-3.1.37 equal to iam-service-default-3.1.37-1911141021_63e48.noarch

iam-python-common-1.0.1 is not present on List2