Skip to content

Commit b83c741

Browse files
committed
Things not to do with Tuples
1 parent e48f075 commit b83c741

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Tuples/3.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Things not to do with Tuples
2+
3+
x = (3, 2, 1)
4+
x.sort()
5+
print(x)
6+
7+
8+
# Output
9+
10+
# Traceback (most recent call last):
11+
# File "C:\Users\FBA_Desktop\Desktop\GitHub Repositories\Python-Data-Structures-by-University-of-Michigan\Tuples\3.py", line 4, in <module>
12+
# x.sort()
13+
# AttributeError: 'tuple' object has no attribute 'sort'
14+
15+
x.append(5)
16+
print(x)
17+
18+
# Traceback
19+
20+
x.reverse()
21+
22+
# Traceback

0 commit comments

Comments
 (0)