d1 = [1,2,3,4]
d2 = [5,6,7,8]
print(d2>d1)
Output: True
d1 = [1,2,3,4]
d2 = [5,6,7,8]
print(d2>d1)
Output: True
because 5>1, it will always compare the first element.
Hey Mohammad_Alim!
It is because the list is compared in order. It starts from the first item of each list.
1
and 5
are unequal in the example, the comparison result is returned.Thank you for asking the question. We hope Educative has inspired you to further your learning.