From 6adb1ff457f60fc3bf7c8385235f7a247edf4c50 Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Sat, 7 Dec 2024 06:51:33 +0100 Subject: [PATCH] math.concat(): concatenate 2 integers (e.g. contcat(12, 34) == 1234) --- src/tools/math.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/math.py b/src/tools/math.py index 91d1b25..a39d55f 100644 --- a/src/tools/math.py +++ b/src/tools/math.py @@ -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