math.concat(): concatenate 2 integers (e.g. contcat(12, 34) == 1234)

This commit is contained in:
Stefan Harmuth 2024-12-07 06:51:33 +01:00
parent e06e536292
commit 6adb1ff457

View File

@ -38,3 +38,7 @@ def mul(ints: Iterable[int]) -> int:
def magnitude(value: int | float) -> int:
return math.floor(math.log10(value))
def concat(value1: int, value2: int) -> int:
return value1 * (10 ** (1 + magnitude(value2))) + value2