python - Setting up numeric boundaries? -
i'm having trouble setting simple boundary.
i've set minimum , maximum boundary using code here.
def min3(n,m,o): if (n<m<o or n<o<m): return(m) elif (o<m<n or o<n<m): return(o) def max3(n,m,o): if (n>m>o or n>o>m): return(n) elif (m>n>o or m>o>n): return(m) elif (o>m>n or o>n>m): return(o)
this code not print values onto terminal, if use:
def min3(n,m,o): if (n<m<o or n<o<m): return("the minimum value is",n)
then values returned printed in terminal "the minimum value n", seems i'm moving along nicely program.
but, when enter boundary code, is:
def boundaries(a,x,b): if (x < a): return false elif(x >=a , x<= b): return true
then run program usual, python3 complains saying
"unorderable types: int() < tuple()"
and can't figure out how either make "x" tuple, or make "a" integer.
does work how expect?
def boundaries(a,x,b): return true if <= x <= b else false
Comments
Post a Comment