Comparing tuples
When comparing tuples: 
- numbers are compared by value; 
- strings in lexicographical order; 
- in case of equality of elements in the same positions, the following elements are compared; 
- comparison of elements will occur until the first inequality; 
- when comparing, elements must be cast to the same type (you cannot compare a number and a string). 
 
Example
1
2
3
4
5
6
7
8
9
10
eleven
12
 
 | 
A=4
B=8
C = 'a',
D = 'z',
E = (14, 'maximum', 'minimum')
F = (14, 'maximum', 'min')
K=999
print(A < B)    # True
print(C < D)    # True
print(E > F)    # True
print(K < F)    # False
print(C < K)    # TypeError: '<' not supported
                # between instances of 'str' and 'int'
 |