Counting primes
Write code · Medium · §2.1 Primes
Complete the function solution, which returns how many primes there are among the positive integers from 1 to limit. limit itself is included.
Function
solution(limit)
Constraints
limitis an integer from 1 to 10,000.
Examples
| limit | result |
|---|---|
10 | 4 |
20 | 8 |
Starter code
def solution(limit):
answer = 0
return answerSolve this problem in your browser
Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.