Logical Statement Coding In Python