A Tuple is a collection of Python objects separated by commas. In some ways a tuple is similar to a list in terms of indexing, nested objects and repetition but a tuple is immutable unlike lists which are mutable.
Creating Tuples
# An empty tuple empty_tuple = () print (empty_tuple)
Output:
()
Creating non-empty tuples
# One way of creation tup = 'python', 'geeks' print(tup) # Another for doing the same tup = ('python', 'geeks') print(tup)
Output
('python', 'geeks')
('python', 'geeks')
Note: In case your generating a tuple with a single element, make sure to add a comma after the element.