input: def is_monotonic(lst: list):
      """Check if list elements are either monotonically increasing or decreasing.
      >>> is_monotonic([1, 2, 4, 20])
      True
      >>> is_monotonic([1, 20, 4, 10])
      False
      >>> is_monotonic([4, 1, 0, -10])
      True
      """
output:     increasing = all(lst[i] <= lst[i + 1] for i in range(len(lst) - 1))
      decreasing = all(lst[i] >= lst[i + 1] for i in range(len(lst) - 1))
      return increasing or decreasing