Python 2: Conditional statement behaviour of lists with greater/smaller [duplicate]

So you are using Python2, where you can compare between list and strings and numbers. This helps to sort them out.

Python2

   [0]>1
=> True

However since Python3 this has been removed.

Python3

   [0]>1
Traceback (most recent call last):
  File "python", line 1, in <module>
TypeError: unorderable types: list() > int() 

Hope that explains, why list has been made to be greater than number is purely subjective and depends on the creators.

Leave a Comment