1234554321' hello! ' T[0]12345t(12345, 54321, ' hello! ')
Tuples: Tuples consist of several values separated by commas
Collection: Set (). The elements in the collection are not in order and are not duplicated. The basic purpose of a collection is to have members test and eliminate duplicate entries. The collection object also supports mathematical operations such as set, intersection, difference, and symmetry.
Curly braces or set () functions can be used to create collections. Note: To create an empty collection you must use set ()and cannot use {}; The latter will create an empty dictionary.
A=Set(' Abracadabra ')>>>B=Set(' Alacazam ')>>>a # unique letters in Aset ([' A ', ' R ', ' B ', ' C ', ' d ']) >>> a -b # letters in A and not in Bset ([' R ', ' d ', ' B ']) >>> a | b # letters in either a or Bset ([' A ', ' C ', ' R ', ' d ', ' B ', ' m ', ' Z ', ' l ']) >>> a & b # letters in Both A and Bset ([' A ', ' C ']) >>> a ^ b # letters in A or B and not bothset ([' R ', ' d ', ' B ', ' m ', ' Z ', ' l '])
Similar to the list deduction type,
The collection also supports the derivation formula:
>>>
{' abc '}aset ([' R ', ' d '])
Python Collection--a tuple that is directly connected with a comma, not a list