Back to General discussions forum
i tried too many times but every time there is slight error in system output to my output.. even i took help of AI but then also there is same problem
def rounding(a,b):
return round(a/b)
c=int(input())
for i in range(c):
a,b=map(int,(input().split()))
print(rounding(a,b),end=" ")
Hi, the problem asks to round "away from zero". You try to use the built-in Python function round to do this, but this function behaves differently. This means you need to do a little bit of case work.
i used every method but problem persist. i used round function also but then also 1-2 test case is failed
I would recommend you to create your own rounding (also, AI gets messy with this cases analysis idk why exactly but it's not the best tool in that problem)
If the decimal part is in the range .0 to .4 then use floor function, else, do ceiling. I hope that is clear enough for you to fix the program.
AI gets messy with this cases analysis idk why exactly but it's not the best tool in that problem
amusing observation, thanks for sharing this! :)
Thanks Everyone! i am able to to solve rounding problem after many try ...finally!!