0 out of 464 challenges solved
Write a Python function `divisible_by_digits(startnum, endnum)` that returns a list of numbers in the range `[startnum, endnum]` (inclusive) where each number is divisible by every non-zero digit it contains. For example: - The number `128` is divisible by `1`, `2`, and `8`, so it satisfies the condition. - The number `102` does not satisfy the condition because it contains the digit `0`. #### Example Usage ```python [main.nopy] print(divisible_by_digits(1, 22)) # Output: [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22] print(divisible_by_digits(20, 25)) # Output: [22, 24] ``` #### Constraints - `startnum` and `endnum` are positive integers with `startnum <= endnum`. - Numbers containing the digit `0` do not satisfy the condition.
def divisible_by_digits(startnum, endnum): """ Find numbers in the given range [startnum, endnum] that are divisible by every non-zero digit they contain. Args: startnum (int): The starting number of the range. endnum (int): The ending number of the range. Returns: list: A list of numbers satisfying the condition. """ # Placeholder for the solution pass