-1

I work with Linux. I get two different outputs when i write those lines:

python2 -c "print [1/Temp for Temp in [1,1.5,2]]"
>>> [1, 0.6666666666666666, 0]

python3 -c "print ([1/Temp for Temp in [1,1.5,2]])"
>>> [1.0, 0.6666666666666666, 0.5]

Why is this happening? Why in python2 command the value of 1/Temp, when Temp=2, equals 0 and not 0.5?

ryden
  • 167
  • 6

0 Answers0