ls = [25, 13, 36, 1]
ls.clear() And del ls The difference between the processing results of :
A.ls.clear() Just clear the list ,del ls Is to delete a list object
The elements that can be generated are 0-9 The tabular derivation of the square of is
B. [x * x for x in range(10)]
Convert multiple integer inputs separated by commas into a list of integers , For example, the input ’1,2,3’, Turn to list [1,2,3]
The following statement is correct :
B. num = list(map(int, input().split(‘,’)))
list ls = [[‘Tom’, 24], [‘Jack’, 18], [‘Ada’, 20]] The second element of each sublist in is age , Output sorted by age , The correct procedure is :
A tuple is a set of data enclosed in parentheses , The data is separated by commas , The data in the following options are of tuple type :
A. ()
C. 1,
D. (1,2,3,4)
The main differences between tuples and lists are :
A. Tuples are immutable data types , Lists are variable data types
C. The delimiters of tuples are parentheses , The delimiter of the list is square brackets
D. The only built-in methods for tuples are count() and index(), There are many built-in methods for lists
In the case of determining the sequence length , Multivariable assignment