Basic Python syntax - tuples and dictionaries

#Tuple variable name=() The tuple is parentheses and cannot be modified
List variable name=[] The list can be modified using the [] sign

Access the tuple to get the data by the index
insert image description here
. The subscript of the tuple is out of bounds
insert image description here
count. Count the number of occurrences.
insert image description here
Query the index index. If the index is present, return the index and report an error . Tuple
insert image description here
insert image description here
cannot be modified (immutable) . Group dictionary variable name={key:value,key2:vlaue} key (key): value (value) does not find the corresponding key info add if the key value is found, assign a value to it, if not, add the key and delete the value from the dictionary Query the length of the dictionary to loop through all the keys to take out the value in the dictionary for loop traversal to get the key value enumerate keyword traversal
insert image description here

insert image description here

insert image description here

insert image description here


insert image description here

insert image description here

insert image description here

insert image description here
insert image description here

insert image description here


insert image description here

insert image description here

insert image description here

insert image description here

Guess you like

Origin blog.csdn.net/weixin_44826661/article/details/124062919