title: How can I determine if the numbers in a list initially increase (or stay the same) and then decrease (or stay the same) with Python?
body: <p>For example, the digits of <code>123431</code> and <code>4577852</code> increase and then decrease. I wrote a code that breaks the numbers into a list and is able to tell if all of the digits increase or if all of the digits decrease, but I don't know how to check for digits increasing <em>then</em> decreasing. How do I extend this?</p>
  
  <pre><code>x = int(input("Please enter a number: "))
  y = [int(d) for d in str(x)]
  def isDecreasing(y):
      for i in range(len(y) - 1):
          if y[i] &lt; y[i + 1]:
              return False
          return True
  if isDecreasing(y) == True or sorted(y) == y:
      print("Yes")
  </code></pre>