**************************************************
Python Core PlayList : • Lesson - 01 : Python3 - What is python
Python Advanced PlayList : • Lesson - 46 : Python Advanced - Pytho...
**************************************************
Python DataType : Tuple:
A tuple is a container which holds a series of comma-separated values (items or elements) between parentheses. Tuples are immutable (i.e. you cannot change its content once created) and can hold mix data types.
Tuples are a group of values like a list and are manipulated in similar ways. But, tuples are fixed in size once they are assigned. In Python the fixed size is considered immutable as compared to a list that is dynamic and mutable. Tuples are defined by parenthesis ().
myGroup = ('Rhino', 'Grasshopper', 'Flamingo', 'Bongo')
Here are some advantages of tuples over lists:
Elements to a tuple. Tuples have no append or extend method.
Elements cannot be removed from a tuple.
You can find elements in a tuple, since this doesn’t change the tuple.
You can also use the in operator to check if an element exists in the tuple.
Tuples are faster than lists. If you’re defining a constant set of values and all you’re ever going to do with it is iterate through it, use a tuple instead of a list.
It makes your code safer if you “write-protect” data that does not need to be changed.
Built-in Tuple Functions :
cmp(tuple1, tuple2) : Compares elements of both tuples.
len(tuple) : Gives the total length of the tuple.
max(tuple) : Returns item from the tuple with max value.
min(tuple) : Returns item from the tuple with min value.
tuple(seq) : Converts a list into tuple.
Sample Projects : https://github.com/SadaLearningHub1/P...
Nesta página do site você pode assistir ao vídeo on-line Lesson - 18 : Python3 - Python Variables : Tuple duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Sada Learning Hub 17 Dezembro 2017, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 66 vezes e gostou 2 espectadores. Boa visualização!