test for isInRange?

Gerrit Holl gerrit at nl.linux.org
Wed Mar 1 05:54:04 EST 2000


<quote name="Janko Hauser" date="951906040" email="jhauser at ifm.uni-kiel.de">
> As it seems, that at the moment all bot's are very creative, I dare to
> ask a question.
> 
> What is the known right(tm) algorithmic answer to the problem if a number
> or a range represented by two numbers(start,stop) is in another range?

>>> x=5
>>> 1<x<6
1
>>> 1<x<4
0

> Think of a database with geographic locations and you want to to ask
> this database (which need not to be a relational db) if there is data
> in a given range. (Forget for the moment problems with cyclic ranges)

>>> if x_low < x < x_high and y_low < y < y_high:
...     print "Huray!"

</quote>

regards,
Gerrit.

-- 
-----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com
Version: 3.12
GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE?
Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y
-----END GEEK CODE BLOCK-----




More information about the Python-list mailing list