Prime Number Logic For Python Code