Prime Number Python Logic