Python Interview Guide

Useful Functions

  • itertools - chain, permutation, combinations, product, takewhile, dropwhile
  • functools - lru_cache
  • collections - deque, defaultdict, OrderedDict, Counter
  • heap - heapify

Tricks

  • float(“inf”) - largest floating point number
  • inbuilt iter function iterates through the list and forgets the previous elements when used in conditionals
  • any is an inbuilt function
  • extend vs append in python list
  • python -X faulthandler for when python is unable to give proper error for system faults