+ 1

# Code coach round off giving problem😢

Help

8 Answers

+ 14

Huzaifa Red Headphone generally on using Ceil from math can be helpful in rounding thing other than round() function which problem you are facing rounding problem include that too

+ 10

Huzaifa Red Headphone without seeing the code we can say on which scenarios the rounding in not working for which problem. So link the code in the post so we can review it

0

what are you rounding to? from two decimal places to the nearest whole?

0

SQrL whole no. Neither round () nor // work right 😑

0

ok, if you multiply to get into whole numbers, maybe even before division, rounding can be more accurate. i will try to find you something specific to explain it better

0

subt=(sub1+sub2)*110
if(subt%100==0):
print(int(subt/100))
else:
print(int(subt/100)+1)

0

In the code example above i multiplied by 110, which is a percentage. By processing as ints as long as possible I could use the modulus operator to handle my own rounding and always round up to the next whole number, which is differennt tgan what round would do. If you want classic rounding change tge if to compare to 50

0

SQrL ceil function worked out thanks 😄