I would like to implement two functions in leetcode exercise 204. Count Primes. However I am getting Attribute Error: Solution has no atribute notPrrime.
def notPrime(self, n):
l=[]
for i in range(2,n):
for j in range(2,n):
if i*j not in l:
l.append(i*j)
return sorted(l)
class Solution:
def countPrimes(self, n: int) -> int:
non_prime = self.notPrime(n)
prime = []
for i in range(2,n):
if i not in non_prime:
prime.append(i)
return(len(prime))I used the following advice for implementation.
https://leetcode.com/discuss/general-discussion/199808/can-I-define-another-function-in-Python3-in-Solution