[Tutor] Range of float value
kent37 at tds.net
Thu Feb 8 15:35:15 CET 2007
Johan Geldenhuys wrote:
> Hi all,
> I have a value that ranges between 48.01 and 48.57. a Float value in
> other words.
> I want to look at changes in the value. If my normal range is between
> 48.35 and 48.45, how will I identify the value below 48.35 and above 48.45?
> Something I tried was:
> for a in range(48.35, 48.45):
> print a
> It gives me a value of 100.
> Is it possible to get a range of a float value?
You can't generate all the float values in a range. (OK, you probably
could, but it would not be practical or useful.) You can test for a
value in a range, e.g.
if 48.35 <= a <= 48.45:
# do something
More information about the Tutor