Answered step by step
Verified Expert Solution
Question
1 Approved Answer
WRITE IN PYTHON Write a function divisible(String s, int x) that takes a string s as a parameter and returns a list of all of
WRITE IN PYTHON
Write a function divisible(String s, int x) that takes a string s as a parameter and returns a list of all of the unique numbers contained in that string that are divisible by non-negative integer x, but do not include integer x within the number itself. For example, 24 and 16 are both divisible by 4, but 24 includes the number 4 so it is not counted. If there are no such numbers found in the string, the function will return an empty list. Consider all string inputs, even those containing numbers and letters. Letters will act as "blockers between numbers. For example, for the string "123a4, the numbers 123 and 4 should be checked but 1234 should not be. You may make helper functions if you see them as necessary. See the test cases below Input Output divisible("tothemoon, 1) divisible("a465839485739b102988c30jklol4, 7) divisible("a1234567890ef, 5) divisible("1782931, 1894792) divisible( Jennychangeyournumber8675309, 0) [0, 98, 1029, 3948, 6583948, 9485, 658, 58394] [0, 90, 890, 7890, 67890] [ ]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started