-2

What I mean by that is, that I want to take a list, let's say"

["i","am","you","pure","fact"], 

then check whether this list contains 2 different strings, like "i" and "pure", and then if true, it runs something. This is what I am looking for, but in PYTHON. I don't know how to do this sort of check.

1 Answers1

3

Try this out

elements: list = ["i","am","you","pure","fact"]
str1: str = "i"
str2: str = "pure"

if str1 in elements and str2 in elements:
    # Execute code
    ...
rafidini
  • 216
  • 1
  • 8