python count if item in set code example

Example 1: how to check an element in a list in python

thislist = ["apple", "banana", "cherry"]
if "apple" in thislist:
  print("Yes, 'apple' is in the fruits list")

Example 2: how to find item in list python without indexnig

>>> ["foo", "bar", "baz"].index("bar")
1

Example 3: if list item in string python

if any(ext in url_string for ext in extensionsToCheck):
    print(url_string)

Example 4: php check if item in array

$allowedFileType = ['application/vnd.ms-excel','text/xls','text/xlsx','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'];
  
if(in_array($_FILES["file"]["type"],$allowedFileType))