0 out of 464 challenges solved
Write a function `is_samepatterns(colors, patterns)` that checks whether the sequence in the `colors` list follows the sequence given in the `patterns` list. Each unique element in `patterns` should map to a unique element in `colors`, and the order of mapping should be consistent. #### Function Signature ```python [main.nopy] def is_samepatterns(colors: list, patterns: list) -> bool: ``` #### Input - `colors`: A list of strings representing colors. - `patterns`: A list of strings representing patterns. #### Output - Returns `True` if the sequence in `colors` follows the sequence in `patterns`, otherwise `False`. #### Example Usage ```python [main.nopy] is_samepatterns(["red", "green", "green"], ["a", "b", "b"]) # True is_samepatterns(["red", "green", "blue"], ["a", "b", "b"]) # False is_samepatterns(["red", "green"], ["a", "b", "b"]) # False ```
def is_samepatterns(colors: list, patterns: list) -> bool: """ Check if the sequence in colors follows the sequence in patterns. Args: colors (list): A list of strings representing colors. patterns (list): A list of strings representing patterns. Returns: bool: True if the sequence in colors follows the sequence in patterns, False otherwise. """ # Placeholder for the solution pass