I'm having trouble with determining whether or not a specific word lies in a list. For example, if I have the list mylist=["This is a","test list that","serves as an example"]
and say I want to determine whether or not a specific word lies in a specific index of the list:
def test():
if "This" in mylist[0] == True:
print("In index")
else:
print("Not in index")
Obviously, the word "This" lies in mylist[0]
, but whenever I run test()
, it prints "Not in index". What is the error?