0 out of 464 challenges solved
Write a function `find_adverb_position` that takes a string `text` as input and returns a tuple containing the start position, end position, and the adverb itself for the first adverb found in the text. An adverb is defined as a word ending with "ly". If no adverb is found, return `None`. #### Example Usage ```python [main.nopy] find_adverb_position("clearly!! we can see the sky") # Output: (0, 7, 'clearly') find_adverb_position("seriously!! there are many roses") # Output: (0, 9, 'seriously') find_adverb_position("no adverbs here") # Output: None ```
import re def find_adverb_position(text): """ Find the first adverb in the text and return its position and value. Args: text (str): The input text to search. Returns: tuple or None: A tuple (start, end, adverb) if an adverb is found, otherwise None. """ # Use a regular expression to find words ending with 'ly'. # Return the first match's start, end, and the word itself. pass