Logical Operators On String In Python Function