Should'n it be as simple as this?
def round_down(num, decimals): a, b = str(num).split(".") return f"{a}.{b[:decimals]}" a = 28.266 print(round_down(a, 2)) # 28.26