I wrote below python code. And I found that python2 and python3 has totally difference running result for input of 1.1. Why is there such difference between python2 and pyth
Please check the Python 3 release notes. In particular, the input() function (which is considered dangerous) was removed. In its stead, the safer raw_input() function was renamed to input().
In order to write code for both versions, only rely on raw_input(). Add the following to the top of your file:
try:
# replace unsafe input() function
input = raw_input
except NameError:
# raw_input doesn't exist, the code is probably
# running on Python 3 where input() is safe
pass
BTW: Your example code isn't minimal. If you had further reduced the code, you would have found that in one case int() operates on a float and in the other on a str which would then have brought you to the different things that input() returns. A look at the docs would then have given you the final hint.