Skip to content

Instantly share code, notes, and snippets.

@yi-mei-wang
Last active October 23, 2019 06:53
Show Gist options
  • Save yi-mei-wang/068c32c943fb2b05dd3bb77fdffbe5c6 to your computer and use it in GitHub Desktop.
Save yi-mei-wang/068c32c943fb2b05dd3bb77fdffbe5c6 to your computer and use it in GitHub Desktop.
Python day 1 part 2

Today's agenda!

  1. Comments

  2. Lists (just an array)

    1. Slice syntax
    2. name_of_list[start:end:step]
  3. Dictionaries (just an object)

    1. Accessing items inside a dict
  4. Nesting (lists in dicts in lists in dicts???)

    some_data = [{"name": "mei", "favourite_food": ["avocado", "potato", "kale"]}]
    # To get avocado
    print(some_data[0]['favourite_food'][0])
  5. Tuples (fixed order, immutable)

    1. e.g., my_tuple = (1, January, 2019)
    2. List should have homogenous data, while tuple should have heterogenous
    3. List vs tuple: https://www.programiz.com/python-programming/list-vs-tuples
  6. Sets (no duplicate values)

    1. Useful for comparison
  7. Loops (for i in my_list)

  8. Loops challenge

  9. Search algorithm

    1. Linear search
    2. Binary search
  10. Roman numerals again

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