Back to Problem Solutions forum
16 14 2 11 12 17 -3 11928 0 192557 12 1 15385 3 2958 17 10 14 2 -2 -3 10 14 2230 3 3 9 50012
16 14 2 11 13 17 -3 11928 0 192557 12 1 15385 3 2958 17 11 14 2 -2 -3 10 14 2230 3 3 9 50012
I'm getting a 12 but I should get a 13, the same goes for 10, I should get an 11
def rounding():
raw_lst = [int(s) for s in input().split()]
split_lst = [raw_lst[i:i+2] for i in range(0, len(raw_lst),2)]
result_lst = [round(a/b) for a,b in split_lst]
return str(result_lst).replace(',','').replace('[','').replace(']','').replace('\n', '').replace(' ',' ')
Why I get a 12 but I should get a 13, the same goes for 10, I should get an 11
Python embedded round() function does a "bank" rounding, not a "math" one. So you get error when rounding numbers with exact 0.5 fraction part.
In python you have to imlement your own rounding function.