Add elongate method
This commit is contained in:
parent
9567227ab9
commit
ef254769b9
1 changed files with 4 additions and 1 deletions
|
@ -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
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue