def substrings_of_length(length, string):
  """
  Given a string, return a list of all substrings of that string with a given
  length.

  For example, substrings_of_len(2, "ABC") returns ["AB", "BC"].
  """
  # You could also use a generator here, but I don't want to overcomplicate
  # things.
  substrings = []
  for i in range(len(string) - length):
    substrings.append(string[i : i + length])
  return substrings