From 2f5c9d003b314837808f1af3f9ad3725cd98a7d4 Mon Sep 17 00:00:00 2001 From: Renato Grimes <12136149+renatohgrimes@users.noreply.github.com> Date: Thu, 21 Jan 2021 20:43:08 -0300 Subject: [PATCH 1/5] Create comparison.md Creates a file that contains a comparison table of the python collection data types. --- src/data_types/comparison.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/data_types/comparison.md diff --git a/src/data_types/comparison.md b/src/data_types/comparison.md new file mode 100644 index 00000000..097f9d7c --- /dev/null +++ b/src/data_types/comparison.md @@ -0,0 +1,15 @@ +* 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 + + +| | {dictio:nary} | {set} | [list] | (tuple) | +|-------------------|---------------|-------|--------|---------| +| Changeble? | yes | no¹ | yes | no | +| Indexed? | N/A | no | yes | yes | +| Ordered? | no | no | yes | yes | +| Allow Duplicates? | no | no | yes | yes | + +¹ can add new items + From f0f9c5cf301f43fd0ab51a7ba5880ddafe34b63f Mon Sep 17 00:00:00 2001 From: Renato Grimes <12136149+renatohgrimes@users.noreply.github.com> Date: Thu, 21 Jan 2021 21:22:43 -0300 Subject: [PATCH 2/5] Update and rename comparison.md to collection-comparison.md Adds a description for dictionary --- src/data_types/{comparison.md => collection-comparison.md} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename src/data_types/{comparison.md => collection-comparison.md} (87%) diff --git a/src/data_types/comparison.md b/src/data_types/collection-comparison.md similarity index 87% rename from src/data_types/comparison.md rename to src/data_types/collection-comparison.md index 097f9d7c..40d0a3c3 100644 --- a/src/data_types/comparison.md +++ b/src/data_types/collection-comparison.md @@ -7,9 +7,10 @@ | | {dictio:nary} | {set} | [list] | (tuple) | |-------------------|---------------|-------|--------|---------| | Changeble? | yes | no¹ | yes | no | -| Indexed? | N/A | no | yes | yes | +| Indexed? | yes² | no | yes | yes | | Ordered? | no | no | yes | yes | | Allow Duplicates? | no | no | yes | yes | ¹ can add new items +² indexed through keys From 1635506c14db6577fb3c5fbd2ff867c7d5c78a33 Mon Sep 17 00:00:00 2001 From: Renato Grimes <12136149+renatohgrimes@users.noreply.github.com> Date: Fri, 22 Jan 2021 10:12:49 -0300 Subject: [PATCH 3/5] Add reference to collection comparison table --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2a39aa0b..3bac26e0 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) + - [Collections Comparison](src/data_types/collection-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) From 2e0e2ba460bd9cb94f5f9ec723c054c845c2e7ae Mon Sep 17 00:00:00 2001 From: Renato Grimes <12136149+renatohgrimes@users.noreply.github.com> Date: Fri, 22 Jan 2021 10:21:53 -0300 Subject: [PATCH 4/5] Update and rename collection-comparison.md to data_structures_comparison.md Renames file to a better description and adds initializer to table --- ...{collection-comparison.md => data_structures_comparison.md} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename src/data_types/{collection-comparison.md => data_structures_comparison.md} (83%) diff --git a/src/data_types/collection-comparison.md b/src/data_types/data_structures_comparison.md similarity index 83% rename from src/data_types/collection-comparison.md rename to src/data_types/data_structures_comparison.md index 40d0a3c3..5e55062a 100644 --- a/src/data_types/collection-comparison.md +++ b/src/data_types/data_structures_comparison.md @@ -4,8 +4,9 @@ * Allow Duplicates: the collection can have items with the same value -| | {dictio:nary} | {set} | [list] | (tuple) | +| | dictionary | set | list | tuple | |-------------------|---------------|-------|--------|---------| +| Initializer | { key:value } | { } | [ ] | ( ) | | Changeble? | yes | no¹ | yes | no | | Indexed? | yes² | no | yes | yes | | Ordered? | no | no | yes | yes | From b63db70004a95b96f15cb4af3882573f6c7975e8 Mon Sep 17 00:00:00 2001 From: Renato Grimes <12136149+renatohgrimes@users.noreply.github.com> Date: Fri, 22 Jan 2021 10:24:53 -0300 Subject: [PATCH 5/5] Rename data structure reference --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3bac26e0..6fd04c61 100644 --- a/README.md +++ b/README.md @@ -80,7 +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) - - [Collections Comparison](src/data_types/collection-comparison.md) + - [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)