using and operator in python if statement