Tuples do not have all the methods that lists have.
They do support the usual sequence operations that we saw for both strings and lists:
print( (1, 2) + (3, 4) ) # Concatenation print( (1, 2) * 4 ) # Repetition T = (1, 2, 3, 4) # Indexing, slicing print( T[0], T[1:3] )
To create a single-item tuple, add a trailing comma after the single item, before the closing parenthesis:
x = (40) # An integer! print( x ) y = (40,) # A tuple containing an integer print( y )