tuples tuple is essentially an immutable list below is list with three elements and tuple with three elementsl [ , , ( , , tuples are enclosed in parenthesesthough the parentheses are actually optional indexing and slicing work the same as with lists as with listsyou can get the length of the tuple by using the len functionandlike liststuples have count and index methods howeversince tuple is immutableit does not have any of the other methods that lists havelike sort or reverseas those change the list we have seen tuples in few places already for instancefonts in tkinter are specified as pairslike ('verdana', )and sometimes as triples the dictionary method items returns list of tuples alsowhen we use the following shortcut for exchanging the value of two or more variableswe are actually using tuplesa, , one reason why there are both lists and tuples is that in some situationsyou might want an immutable type of list for instancelists cannot serve as keys in dictionaries because the values of lists can change and it would be nightmare for python dictionaries to have to keep track of tupleshowevercan serve as keys in dictionaries here is an example assigning grades to teams of studentsgrades {'john ''ann ') 'mike ''tazz ') alsoin situations where speed really matterstuples are generally faster than lists the flexibility of lists comes with corresponding cost in speed tuple to convert an object into tupleuse tuple the following example converts list and string into tuplest tuple([ , , ] tuple'abcde 'note the empty tuple is (the way to get tuple with one element is like this( ,something like ( will not work because that just evaluates to as in an ordinary calculation for instancein the expression +( * )we don' want the ( * to be tuplewe want it to evaluate to number sets python has data type called set sets work like mathematical sets they are lot like lists with no repeats sets are denoted by curly braceslike below