I have two list
first= (1,2,3,4,5,6)
last=(6,5,4,3,2,1)
I need to compare the corresponding values only. I have used the below code and getting 36 results as the 1st element in first is comparing with all the six elements of last list.
for x in first:
for y in last:
if x>y:
print("first is greater then L2",y)
elif x==y:
print("equal")
else:
print("first is less then L2",y)
irst= (1,2,3,4,5,6)
last=(6,5,4,3,2,1)
for x in first:
for y in last:
if x>y:
print("first is greater then L2",y)
elif x==y:
print("equal")
else:
print("first is less then L2",y)
output:
L1 is less then L2 6
L1 is less then L2 5
L1 is less then L2 4
L1 is less then L2 3
L1 is less then L2 2
go dada
L1 is less then L2 6
L1 is less then L2 5
L1 is less then L2 4
L1 is less then L2 3
go dada
L1 is greater then L2 1
L1 is less then L2 6
L1 is less then L2 5
L1 is less then L2 4
go dada
L1 is greater then L2 2
L1 is greater then L2 1
L1 is less then L2 6
L1 is less then L2 5
go dada
L1 is greater then L2 3
L1 is greater then L2 2
L1 is greater then L2 1
L1 is less then L2 6
go dada
L1 is greater then L2 4
L1 is greater then L2 3
L1 is greater then L2 2
L1 is greater then L2 1
go dada
L1 is greater then L2 5
L1 is greater then L2 4
L1 is greater then L2 3
L1 is greater then L2 2
L1 is greater then L2 1
y
I need results by comparing the corresponding elements only. Which means there should be only six outputs.