Answers for "tuple comparison python"

0

tuple comparison python

'''In python, tuples are compared item by item, by the order of the index
0 with 0, 1 with 1...
Here are some examples'''
>>> (2, 4) < (1, 5)
False # Because 1 < 2
>>> (2, 4) < (2, 5)
True # Because 4 < 5
'''Length does not really matters, False is returned for the first comparison
that fails'''
>>> (2, 4, 120) < (2, 5, 0)
True
>>> (2, 4, 120) < (2, 5)
True
Posted by: Guest on October-26-2021

Python Answers by Framework

Browse Popular Code Answers by Language