lib.algebra

1def makeOdd(n: float | int) -> int:
2    """Round a number to the nearest odd integer."""
3    n_rounded = round(n)
4    if n_rounded % 2 == 0:
5        return n_rounded + 1
6    return n_rounded
def makeOdd(n: float | int) -> int:
2def makeOdd(n: float | int) -> int:
3    """Round a number to the nearest odd integer."""
4    n_rounded = round(n)
5    if n_rounded % 2 == 0:
6        return n_rounded + 1
7    return n_rounded

Round a number to the nearest odd integer.