In the first code,
arr = ['a', 'ab', 'abc', 'b', '1', 'c']
if 'a' and 'b' and 'c' in arr:
print(True)
the if 'a' and 'b' and 'c' in an arr statement is not checking if all three strings are in the list.
Instead, it's checking if the string 'a' is true, then checking if the string 'b' is true, and then checking if the string 'c' is in the list.
So it is checking step by step and stop checking when condition is false.
While in your second code
arr1 = ['a', 'ab', 'abc', 'b', '1', 'c']
if 'a' in arr1 and 'b' in arr1 and 'c' in arr1:
print(True)
if 'a' in arr1 and 'b' in arr1 and 'c' in arr1, correctly checks if all three strings are present in the list arr1.