I am using some old codes written in Python 3 in my Google-App-Engine project which is using Python 2.7. The different round() algorithms in Python 3 and Python 2 gives me a headache. Is there any convenient way to implement a Python 3's round() method in Python 2.7?
A further question: Python 2 and Python 3 handle the integer operations quite differently. For example the following statements have different outputs in Python 2 and 3:
2/4 # 0 in Python 2, 0.5 in Python 3
round(3/2)
math.ceil(0.5) # 1.0 in Python 2, 1 in Python 3
Any easy way to convert codes from Python 3 to Python 2 while keeping the behavior to be exactly the same?
Thanks!