Beginning to python , what is the wrong with this code?

def is_group_member(group_data):
n = 8
for value in group_data:
if n == value:
return str(n) +" “+” is in the list"
else:
return str(n)+" "+ “is not in the list”

my_list=[1, 5, 8, 3]
print(is_group_member(my_list))

I don’t know, what is wrong with the code? What happens when you run it?

Also, please post your code between code fences so that the formatting isn’t destroyed.

```
code goes here
```

If you want to check whether an element is in a list, you can use the in operator:

mylist = [2, 1, 8, 5]
print(8 in mylist)  # Prints "True"
print(4 in mylist)  # Prints "False"
def is_group_member(group_data):
    n = 8
    for value in group_data:
        if n == value: # at this point, n=8 and value=1, which will trigger the 'else:' clause
            return str(n) +" "+" is in the list"
        else: # if triggered, the 'for loop' will will be terminated by the 'return'
            return str(n)+" "+ "is not in the list"

my_list=[1, 5, 8, 3]
print(is_group_member(my_list))