diff --git a/README.md b/README.md index 2a39aa0b..6fd04c61 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ written correctly. - [Sets](src/data_types/test_sets.py) and their methods - [Dictionaries](src/data_types/test_dictionaries.py) - [Type Casting](src/data_types/test_type_casting.py) + - [Data Structures Comparison](src/data_types/data_structures_comparison.md) 4. **Control Flow** - [The `if` statement](src/control_flow/test_if.py) - [The `for` statement](src/control_flow/test_for.py) (and `range()` function) diff --git a/src/data_types/data_structures_comparison.md b/src/data_types/data_structures_comparison.md new file mode 100644 index 00000000..5e55062a --- /dev/null +++ b/src/data_types/data_structures_comparison.md @@ -0,0 +1,17 @@ +* Changeble: can add or remove items after the collection has been created +* Indexed: first item has index [0], the second item has index [1] and so on +* Ordered: items have a defined order, and that order will not change +* Allow Duplicates: the collection can have items with the same value + + +| | dictionary | set | list | tuple | +|-------------------|---------------|-------|--------|---------| +| Initializer | { key:value } | { } | [ ] | ( ) | +| Changeble? | yes | no¹ | yes | no | +| Indexed? | yes² | no | yes | yes | +| Ordered? | no | no | yes | yes | +| Allow Duplicates? | no | no | yes | yes | + +¹ can add new items + +² indexed through keys