Write a function is_repeated_thrice(s) that returns True if the non-empty string s is made by writing the same piece of text exactly three times one after the other, like "abcabcabc". This needs the length of s to be divisible by 3 and its three equal-sized parts to be identical. Otherwise it returns False.
NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition.
is_repeated_thrice("abcabcabc") -> True
is_repeated_thrice("xyzxyzxyz") -> True
Implement this function:
def is_repeated_thrice(s: str) -> bool:
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: s.
Input
"abcabcabc"
Output
True
Write a function `is_repeated_thrice(s)` that returns `True` if the non-empty string `s` is made by writing the same piece of text exactly three times one after the other, like `"abcabcabc"`. This needs the length of `s` to be divisible by 3 and its three equal-sized parts to be identical. Otherwise it returns `False`. NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition. ### Example ``` is_repeated_thrice("abcabcabc") -> True is_repeated_thrice("xyzxyzxyz") -> True ``` ## Your task Implement this function: ```python def is_repeated_thrice(s: str) -> bool: ``` Write the function only — the arguments are read for you and the return value is printed automatically. **Arguments** arrive as one Python literal per line, in this order: `s`. ## Example **Input** ``` "abcabcabc" ``` **Output** ``` True ``` Write a function `is_sum_of_ends_divisible_by_k(nums, k)` that returns `True` if the sum of the first and the last element of the tuple `nums` is divisible by `k`, and `False` otherwise. NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition. ### Example ``` is_sum_of_ends_divisible_by_k((10, 20, 30), 10) -> True is_sum_of_ends_divisible_by_k((2, 4, 6), 5) -> False ``` ## Your task Implement this function: ```python def is_sum_of_ends_divisible_by_k(nums: tuple, k: int) -> bool: ``` Write the function only — the arguments are read for you and the return value is printed automatically. **Arguments** arrive as one Python literal per line, in this order: `nums`, `k`. ## Example **Input** ``` (10, 20, 30) 10 ``` **Output** ``` True ``` Write a function `move_even_indices_to_end_reversed(t)` that returns a new tuple. It starts with the elements of `t` at the odd indices (1, 3, 5, ...), in their original order. After them come the elements at the even indices (0, 2, 4, ...), in the reverse order. NOTE: This is a function type question, you don't have to take input or print the output, just have to complete the required function definition. ### Example ``` move_even_indices_to_end_reversed((10, 20, 30, 40, 50)) -> (20, 40, 50, 30, 10) move_even_indices_to_end_reversed((1, 2, 3, 4)) -> (2, 4, 3, 1) ``` ## Your task Implement this function: ```python def move_even_indices_to_end_reversed(t: tuple) -> tuple: ``` Write the function only — the arguments are read for you and the return value is printed automatically. **Arguments** arrive as one Python literal per line, in this order: `t`. ## Example **Input** ``` (10, 20, 30, 40, 50) ``` **Output** ``` (20, 40, 50, 30, 10) ```