I have a list:
list = ["A", "A", "B", "A", "C"]
and a for
and if
statement combined:
for x in list:
if "A" in x:
print("true")
Output for the above code:
true
true
Next, I am figuring out how to tell me there is duplicates of "A"
in list and return me value of True
Here is what i have tried:
for x in list:
if any(x == "A" in x):
return True
but an error shows up:
SyntaxError: 'return' outside function
tried this too:
for x in list:
if any(x == "A" in x):
return True
SyntaxError: expected an indented block
my desired output would be:
True
because duplicates of "A"
exists