Skip to content

Conversation

@hitchcock9000
Copy link

Description

Wrapped up the lab on tuples, sets, and dictionaries. Here's what I worked through:

Tuples section:

  • Figured out how to create single-element tuples (that comma is sneaky!)
  • Played around with immutability - can't change tuples directly, but you can concatenate them to make new ones
  • Used slicing and loops to check if elements exist and count them

Sets section:

  • Generated some random data and converted lists to sets
  • Explored how sets handle duplicates (spoiler: they just disappear)
  • Tried out different set operations like difference, intersection, and union
  • Tested that cool formula: len(set1) + len(set2) = len(set3) + len(set4) + 2 * len(set5)

Main takeaways:

  • Tuples = immutable, but you can work around it
  • Sets = no duplicates, no order, super efficient for comparisons
  • Both have their use cases depending on what you need

Added comments throughout to keep track of my thought process. Everything's tested and working as expected! ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant