Prime Number Logic In Python Code