I have two lists, data1
and data2
:
data1 = [('hello world', [])]
data2 = [('hello world', 'greetings')]
I want to compare the values at the 2nd position of each list.
I am using the following piece of code to compare them, but it is printing only "a equals to c" but not "b equals to d" and it is printing the following result:
"Value_a: hello world, Value_b: [],Value_c: hello world,Value_d: greetings"
for a,b in data1:
for c,d in data2:
print("Value_a: %s, Value_b: %s,Value_c: %s,Value_d: %s,"%(a,b,c,d))
if a is c:
print("a is equal to c")
if b is d:
print("b is equal to d")
count+= 1
print("Count = ",count)