Skip to content

Commit 79cd200

Browse files
committed
Tuples are comparable
1 parent 0ddbe59 commit 79cd200

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Tuples/6.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Tuples are comparable
2+
3+
# The comparison operators work with tuples and other sequences.
4+
# If the first item is equal, python goes on to the next element, and so on, until it finds elements that differ
5+
6+
print((0,1,2) < (5,1,2))
7+
8+
# True
9+
10+
print((0,1,20000000000) < (0,3,4))
11+
12+
# True
13+
14+
print(('Jones' , 'Sally') < ('Jones' , 'Sam'))
15+
16+
# True
17+
18+
print(('Jones' , 'Sally') > ('Adams' , 'Sam'))
19+
20+
# True

0 commit comments

Comments
 (0)