Python Forum
Python Forum
>
Python Coding
>
General Coding Help
> Rounding to the nearest eight
Full Version:
Rounding to the nearest eight
You're currently viewing a stripped down version of our content.
View the full version
with proper formatting.
wallgraffiti
Jul-15-2020, 05:30 PM
Basically, I just need to round a number to the nearest eight and by my research the
round()
function cannot do that.
bowlofred
Jul-15-2020, 05:36 PM
Divide by 8, round(), multiply by 8.
>>> round(3.9 / 8) * 8 0 >>> round(4.1 / 8) * 8 8
wallgraffiti
Jul-15-2020, 06:05 PM
Thanks! That worked.
Python Forum
>
Python Coding
>
General Coding Help
> Rounding to the nearest eight