CSES - Primes

The following pseudocode represents a function count that computes the number of primes in the range 2 \dots n.

function count(n)
    total = 0
    for i = 2 to n
        fail = false
        for j = 2 to i-1
            if i%j == 0
                fail = true
        if not fail:
            total += 1
    return total

Implement a corresponding function with Python. Implement the function in a file primes.py using the following template:

def count(n):
    # TODO

if __name__ == "__main__":
    print(count(2)) # 1
    print(count(10)) # 4
    print(count(11)) # 5
    print(count(100)) # 25
    print(count(1000)) # 168