The tuple()
function is used to create a tuple from a given iterable object. It is also used without any argument to create an empty tuple:
tuple() #create empty tuple tuple(iterable)#create a tuple from an iterable.
copy
When the function is called without any argument, it simply returns an empty tuple.
When the function is called with an iterable object such as a list, set, range, etc, it creates a new tuple object containing the elements from the iterable. An operation like this one which involves explicitly turning an object from one type to another is known as type casting. In this case we are casting objects from other types to tuple.