Text: Python {urgently}
I have already solved part A but I need the code for part B.
#a
import math
def apply_all(fun, lst):
if len(lst) == 0:
return []
else:
return [fun(lst[0])] + apply_all(fun, lst[1:])
print(apply_all(math.sqrt, [4, 9, 16, 25]))
Write a recursive function apply_all that takes a function and a list as arguments and returns a list comprising the results of applying the function to each element of the list.
Example: >>> apply_all(sqrt, [4, 9, 16, 25]) # sqrt = square root function [2, 3, 4, 5]
b. Use the apply_all function to check which string in a list contains numbers only.
apply_all(lambda: ..., ["1234", "hello", "class23"])