Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data structure comparison table #32

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions src/data_types/data_structures_comparison.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
* Changeble: can add or remove items after the collection has been created

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo here. Should be Changeable. Although I personally think you should use Mutable instead.

* 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 |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the above.

| Indexed? | yes² | no | yes | yes |
| Ordered? | no | no | yes | yes |
| Allow Duplicates? | no | no | yes | yes |

¹ can add new items

² indexed through keys