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