code: def window(seq, n=2):
  
      
  
      it = iter(seq)
      result = tuple(islice(it, n))
  
      if len(result) == n:
          yield result
  
      for token in it:
          result = result[1:] + (token,)
          yield result
docs: Yield a sliding window over an iterable.
  
      Args:
          seq (iter): The sequence.
          n (int): The window width.
  
      Yields:
          tuple: The next window.