Prime Number Python Code Logic