I am trying to write a function where it takes a list that contains both numbers and strings and returns only a list containing numbers. The code I have written is shown below, but it keeps throwing an error and I can’t understand what I have done wrong. Hope you can help.
lst = [99, 'no data', 95, 94, 'no data']
def foo(lst):
return [x for x in lst if x.isdigit()]
print(foo(lst))