Python Program Using Logical Functions