0 out of 464 challenges solved
Write a Python function `match_a_followed_by_bs` that takes a string as input and returns `True` if the string contains the letter 'a' followed by one or more 'b's, and `False` otherwise. Use regular expressions to implement this functionality. #### Example Usage ```python [main.nopy] print(match_a_followed_by_bs("ab")) # Output: True print(match_a_followed_by_bs("a")) # Output: False print(match_a_followed_by_bs("abb")) # Output: True print(match_a_followed_by_bs("b")) # Output: False ``` #### Requirements - Use the `re` module for pattern matching. - The function should return a boolean value.
import re def match_a_followed_by_bs(text): """ Check if the input string contains 'a' followed by one or more 'b's. Args: text (str): The input string to check. Returns: bool: True if the pattern is found, False otherwise. """ # Define the regular expression pattern pattern = '' # TODO: Add the correct pattern # Use re.search to find the pattern in the text return bool(re.search(pattern, text))