Really basic problem

tomamil tomamil at gmail.com
Mon Oct 8 11:39:31 CEST 2007


i know this example is stupid and useless, but that's not the answer
to my question.
here it goes:

status = 0.0
for i in range(10):
   status = status + 0.1

   if status == 0.1:
       print status
   elif status == 0.2:
       print status
   elif status == 0.3:
       print status
   elif status == 0.4:
       print status
   elif status == 0.5:
       print status
   elif status == 0.6:
       print status
   elif status == 0.7:
       print status
   elif status == 0.8:
       print status
   elif status == 0.9:
       print status
   elif status == 1.0:
       print status

the expected output:
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0

but it gives me instead:
0.1
0.2
0.4
0.5
0.6
0.7

why?

thanks,

m.




More information about the Python-list mailing list