노마드코더 챌린지/파이썬 2주 완성반

Python으로 웹 스크래퍼 만들기 - Day 5

엘레나림 2024. 4. 19. 16:20
728x90

오늘은 강의보고 퀴즈 푸는 날!

그리고 오늘부터는 영어로 내용을 정리해보려한다. 강의 자체가 영어이기도 하고, 영어 공부도 할 겸

 

주제:

Data Structures Quiz!

 

강의: #4.0 ~ #4.4 (python 자료구조)

  • Organization of data using "Data structure" (자료구조는 데이터를 구조화하고 싶을 때 사용함!)
  • 3 Python data structures : list, tuple, dictionary
    - List & Tuple : Ordered sequences of values
    - Dicts
    • List : We use square brackets to create a list and write data seperated by commas inside of the square brackets.
      ex) days = ["Mon", "Tue", "Wed"]
      • append (arguemnt -> object)
      • remove (argument -> value)
      • pop (argument -> index)
      • insert (argument -> value, object)
      • index (argument -> value, start, stop)
      • count (argument -> value)
      • sort (argument -> key, reverse)
      • reverse
      • clear
      • copy
      • extend (argument -> iterable)

    • Tuple : Tuple is almost like a list. To create a tuple, we use parenthesis instead of the square brackets. The What is the difference between a tuple and a list? a tuple is immutable which means we cannot change it.  
      ex) days = ("Mon", "Tue", "Wed")
      • count (argument -> value)
      • index (argument -> value, start, stop)

    • Dictionary : a word with a definition ~ key & value pair.
      curly brackets

 

  • Function & Method
    • They look the same. Method is just like a function literally..!
    • Method is a function that is bound to data using a dot.

 

  • Mutable <-> Immutable
    • "Modify" in the language of programmers is called "Mutate"

 

  • How to access elements in list, tuple, dicts
    • Open square brackets and write the index which is the position on the list/tuple. ex) days[0]