I would like to know what am I doing wrong with my code. I'm a JavaScript developer & I'm learning Python currently. I'm creating a function that takes a list as an argument, loops through it & appends a new list with items type string from the previous one. However, I'm getting this error SyntaxError: bad input on line 4 in main.py.
First, I would like to know what I'm doing wrong. Second, how can I fix it?
def filter_list(arr):
  results = list()
    for x in arr:
        if isinstance(x, str):
        results.append(x)
        print(results)
filter_list([1, 2, 3, "a", "b", 4])
 
     
     
     
     
    