I’m making sort of a Q&A script in python. It gets raw_input, and sets it as theQuestion. I tried if 'var1' and 'var2' in theQuestion:, but it looks for either string, not both. Is there a way I can make this work in one ‘if’ statement? (not ‘if x: if y: then z).
I’m making sort of a Q&A script in python. It gets raw_input, and sets
Share
andis a logical AND, not a natural-language one. Therefore, your code gets interpreted as:You want to connect the two tests with a logical AND:
Alternatively, for large numbers of tests: