3.7 KiB
3.7 KiB
In [ ]:
# Create a tuple
t = (1,2,3)In [ ]:
# Check len just like a list
len(t)In [ ]:
# Can also mix object types
t = ('one',2)
# Show
tIn [ ]:
# Use indexing just like we did in lists
t[0]In [ ]:
# Slicing just like a list
t[-1]In [ ]:
# Use .index to enter a value and return the index
t.index('one')In [ ]:
# Use .count to count the number of times a value appears
t.count('one')In [ ]:
t[0]= 'change'In [ ]:
t.append('nope')In [ ]: