A result smaller than 0 should be just invalid. I'd like to work with "try" and "except" like this: value=20 try: value=value-23 except: print 'value is smaller than 23'
Now it should run into the "except". Dirk Hagemann Larry Bates <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > What exactly do you want to happen when result > would be negative? I'll guess be zero: > > pseudocode: > > x=value > x=max(x-something, 0) > > That way if it goes negative, it sticks to zero. > > Larry Bates > > > Dirk Hagemann wrote: > > Hi, > > > > Is there a datatype in python which allows no negative values? I > > subtract several times something from a value and I don't want to chek > > everytime if this value is still bigger or equal 0. > > > > Thanks for help! > > Dirk Hagemann -- http://mail.python.org/mailman/listinfo/python-list