0 out of 464 challenges solved
Write a Python function `remove_odd_index_characters(s: str) -> str` that takes a string `s` as input and returns a new string with all characters at odd index positions removed. Indexing starts at 0, so characters at indices 1, 3, 5, etc., should be removed. #### Example Usage ```python [main.nopy] remove_odd_index_characters("abcdef") # Output: "ace" remove_odd_index_characters("python") # Output: "pto" remove_odd_index_characters("data") # Output: "dt" remove_odd_index_characters("lambs") # Output: "lms" ``` #### Constraints - The input string will only contain printable ASCII characters. - The function should handle empty strings gracefully.
def remove_odd_index_characters(s: str) -> str: """ Remove characters at odd index positions from the input string. Args: s (str): The input string. Returns: str: A new string with characters at odd indices removed. """ # Initialize an empty string to store the result result = "" # Iterate through the string and append characters at even indices # Placeholder for implementation return result