From ef254769b9e64a026375f53f8be02fa899948ec4 Mon Sep 17 00:00:00 2001 From: Constantin Gierczak--Galle Date: Mon, 11 Dec 2023 07:27:19 +0100 Subject: [PATCH] Add elongate method --- pyjecteur/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyjecteur/common.py b/pyjecteur/common.py index 7db35fa..62b45b4 100644 --- a/pyjecteur/common.py +++ b/pyjecteur/common.py @@ -5,6 +5,9 @@ from enum import Enum LedBarLen = 16 +def elongate(colors: List[Color], factor: int) -> List[Color]: + return [[elt] * factor for elt in colors] + def remove_duplicates(colors: List[Color]) -> Tuple[List[Color], List[int]]: if len(colors) == 0: return ([], []) @@ -21,7 +24,7 @@ def remove_duplicates(colors: List[Color]) -> Tuple[List[Color], List[int]]: def reduplicate(colors: List[Color], repetitions: List[int]) -> List[Color]: """ Re-duplicates a list. Takes in a list of elements and a list of numbers of - repetitions. Concatetantes the repeted elements. + repetitions. Concatenates the repeted elements. Requires both lists to have the same length """