0
Why does round(2.5) return 2?
Using python 3 round(2.5) # 2 Shouldn't it return 3? I tried using python 2 and it gave me the correct result round(2.5) # 3
3 Antworten
+ 6
Found this in the python documentation: if two multiples are equally close, rounding is done toward the even choice
Try print(round(3.5)) it is 4.
Or try this:
for i in range (0, 100):
print(round(i + 0.5))
+ 2
Arian_s_k
https://code.sololearn.com/cRs3RbKxgq25/?ref=app
click and press RUN. It help you know about all function:)