Is there a way to show float value in Python 2 like Python 3 does?
Code:
text = "print('hello, world')"
step = 100.0 / len(text)
result = 0.0
for _ in text:
result += step
print result
print step
print result == 100.0
Python 2.7.9
100.0
4.7619047619
False
Python 3.4.3
99.99999999999997
4.761904761904762
False
I'm interested in result variable. not in step. Sorry for insufficient explanation what I want. :)