Boolean22. A three-digit number is given. Check the truth of the statement: "The digits of a given number form an increasing or decreasing sequence".

Solution in Python 3:

import random

N = random.randrange(100,1000)
N = 379
print("Number: ", N)
d2 = int(N/100)
d1 = int((N-d2*100)/10)
d0 = N%10
print("Hundreds: ", d2)
print("Tens: ", d1)
print("Units: ", d0)
x = ((d2 < d1) and (d1 < d0)) or ((d2 > d1) and (d1 > d0))
print("The digits form an increasing or decreasing sequence: ", x)