How to check if element is in or not in a list with Python

1 Answer

0 votes
lst = ["python", "java", "c++"]

if "java" in lst:
    print("'java' in lst")

if "php" not in lst:
    print("'php' not in lst")

'''
run:

'java' in lst
'php' not in lst

'''

 



answered Nov 2, 2018 by avibootz
...