← Back to mit.katmh.com

Word Play

· Read 03/03/21

  • Python lets you put underscores in a number, e.g. 10_000_000
  • count = sum((i in big_num_list) for i in small_num_list)
  • .discard(element) does nothing if element not in set, .remove() will raise an exception
  • for key, val in table.items()
  • Dictionary comprehension: {n: 'x'*n for n in range(8)}