0 out of 464 challenges solved
Write a Python function `find_first_adverb` that takes a string as input and identifies the first adverb ending with "ly" in the string. The function should return a tuple containing the adverb and its start and end positions in the string. If no such adverb is found, return `None`. #### Example Usage ```python [main.nopy] find_first_adverb("Clearly, he has no excuse for such behavior.") # Output: ('Clearly', 0, 7) find_first_adverb("Please handle the situation carefully.") # Output: ('carefully', 28, 37) find_first_adverb("This sentence has no adverbs.") # Output: None ```
import re def find_first_adverb(text): """ Finds the first adverb ending with 'ly' in the given text and its positions. Args: text (str): The input string to search. Returns: tuple: A tuple containing the adverb and its start and end positions, or None if no adverb is found. """ # Implement the function logic here pass