How to use the and operator in an if statement of Python?