Count Primes Leetcode Solution Python