The set of tuples 2019/11/28

Tuple tuple

TUP = (1,2,3,4,5)

tup = (1,) an element to include a comma

tup = () empty tuple

Built-in method of tuples :( only two kinds)

index to find subscript (index)

count to find out the number of occurrences

 

Tuples and lists the differences:

Tuples: immutable

List: Variable (by subscript)

In common: 1 can go through index values

              2. ordered

              3. Slice the same way

 

Set set {}

There deduplication effect can not go through the subscript value

set_1 = set () defines an empty set

set_2 = {} is the actual definition of a dictionary can be used to check the type dict = {}

Guess you like

Origin www.cnblogs.com/zhaoxiangji/p/11967607.html