To update list elements ** List [index number] = value ** Adding new elements ** List.append (value) ** Added to the end of an already defined list
** for statement ** List elements can be retrieved and processed in order ** for variable name in list: ** Only the number of lists is processed Variable names are free, and it is customary to use the singular form of list names.
dictionary Manage multiple data at once The difference from the list is that each element is managed by giving it a name called a key instead of an index number. ** {Key 1: Value 1, Key 2: Value 2,…} ** Write like this Elements in the dictionary are out of order To retrieve the dictionary value, write it like the dictionary name [key] using the "key" corresponding to the value you want to retrieve. Update and add dictionary elements
Recommended Posts