Skip to content

Latest commit

 

History

History
9 lines (8 loc) · 630 Bytes

learnings.md

File metadata and controls

9 lines (8 loc) · 630 Bytes

2023

Day 4

  • Python list.index() will give the location of the first occurence of an element in a list. It can be useful for getting the part of a list before and after a certain marker
  • Python list.count(a) will count occurences of a in the list
  • [1,2,3]*3 will evaluate to [1,2,3,1,2,3,1,2,3]
  • frozenset is a hashable but immutable type of set. In other words, frozenset can not be modified after creation but can be used for e.g. dict keys
  • math.gcd(*args) for greatest divisor and math.lcm(*args) for least common multiple
  • math.prod(iterable). No need for np.prod and works on all iterables