What is the output of print(round(2.5)) in Python?
print(round(2.5))
Correct answer
B. 2
6 views
B. 2
6 views
Python 3 uses banker's rounding (round half to even), so round(2.5) is 2 while round(3.5) is 4.
Asked in: Python Interview Data Types
https://docs.python.org/3/library/stdtypes.htmlNot sure why the answer is B? Ask here and get an explanation.