meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
programming:python:syntax:collections [2024/03/01 07:41] – created niziakprogramming:python:syntax:collections [2025/01/02 11:02] (current) niziak
Line 1: Line 1:
 ====== collections ====== ====== collections ======
  
-  * List ''[]''+  * **List** ''"abc", 1, True ]''
     * ordered, indexed, allow duplicate items     * ordered, indexed, allow duplicate items
     * mutable     * mutable
-  * Tuple ''( 1, "A", True)''+    * list item can be any type 
 +    * ''len()'' 
 +  * **Tuple** ''( 1, "A", True)''
     * ordered, indexed, allow duplicate items     * ordered, indexed, allow duplicate items
-    * immutable +    * **immutable** 
-  * Set +    * tuple item can be any type 
-    * unordered, unindexed, no duplicate items+  * **Set** ''{ "abc", 34, True }'' 
 +    * **unordered**, unindexed, no duplicate items 
 +      * ''1'' and ''True'' (and ''0/False'') are the same items (duplicates)
     * items are immutable     * items are immutable
     * set is mutable (add/remove items)     * set is mutable (add/remove items)
-  * Dictionary ''[]'' +    * set item can be any type 
-    * ordered (from v3.7)+  * **Dictionary** ''{ "keyA": value, "keyB": value }'' 
 +    * stores ''key:value'' pairs 
 +    * ordered (from v3.7), no duplicate items (keys)
     * mutable     * mutable
-    * no duplicate items+    * value can be any type