Logic In Python Program