0

I am seeing some code online for python and testing a few things on my own. I found this sample online and I am very confused...

I have 2 lists of ints, I compare if one list is greater than the other and return true if it is, except I am confused on what is being compared? its not the length or the sum of values, so I do not know why its returning True.

list1 = [0, 1, 2, 4]
list2 = [0, 1, 2, 3, 4]

if list1 > list2:
    print("true")
else:
    print("false")
  • see https://docs.python.org/3/tutorial/datastructures.html#comparing-sequences-and-other-types – nbk Jul 03 '21 at 17:59
  • Like string, every index is compared one by one, the 3 first values are same, then you have `3<4` – azro Jul 03 '21 at 18:03

0 Answers0