Built-in data structure

zhaozj2021-02-16  88

Linked list

>>> array = [2, 4, 6] >>> [[x, x ** 3] for x in array if x <= 4] [[2, 8], [4, 64]]

>>> a = ['Name', 'Question', 'Favorite Color'] >>> B = ['Alin', 'Are you a American?', 'Blue'] >>> for i, j in zip (a, b): ... Print 'What is your% s? IT IS% s.'% (i, j) ... What is your name? it is alin.what is your question? It is are you A American? .what is your favorite color? it is blue.

dictionary

>>> A = DICT ([x, x ** 2) for x in {1: 1, 2: 4, 3: 9, 4: 16} >> > DEL A [2] >>> A ['alin'] = 33 >>> a {1: 1, 3: 9, 4: 16, 'Alin': 33} >>> a.keys () [1 , 3, 4, 'Alin'] >>> A.has_Key ('alin') True >>> for K, L in A.Items (): ... Print K, L ... 1 13 94 160003

转载请注明原文地址:https://www.9cbs.com/read-13204.html

New Post(0)