[Tutor] Range of float value

Andre Engels andreengels at gmail.com
Thu Feb 8 18:16:49 CET 2007


2007/2/8, Johan Geldenhuys <johan at accesstel.co.za>:
>
>  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?
>

It depends. What would you like it to be? All numbers in that range? They're
uncountably infinite, so no way we could ever get that out of the computer.
All actual float values? Depends too much on the implementation of the
specific machine you're working on to be workable.

Identifying values below 48.35 and above 48.45 is simply done by:
if value < 48.35 or value > 48.45 then...

No need to first create the range of values

-- 
Andre Engels, andreengels at gmail.com
ICQ: 6260644  --  Skype: a_engels
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070208/c0d6f1f8/attachment.htm 


More information about the Tutor mailing list