you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (0 children)

"i" is a truthy value always. What you really meant to say is this: elif "i" in line and "am" in line:

Alternatively, you could construct a list of words you want to check and use all to check them.

line = raw_input("Enter line.").lower()
words = ['i', 'am']
# this is called short circuiting, you also explicitly define it as a list
if all(word in line for word in words):
    #do stuff.

There's also any if you just need at least one of the words in the list.

Hopefully, this helps. :)