"Find the sum of all the primes below two million"
To say that prime numbers are essential is not an understatement.
To work with prime numbers we have to clear some basics:
- Prime numbers cannot be divided by any other number other than itself (and one, of course)
- Numbers zero, one and all negatives are not primes - don't insist!
- Prime number generation is a very intensive process
- Get acquainted with prime numbers by learning about the [sieve of Eratosthenes] https://planetmath.org/sieveoferatosthenes
To build a prime number generator, we have to examine two pieces: (1) the "prime number generator" and (2) the accumulator loop
In Python 3, part (1) looks like this
Part (2) can look like a loop through a range of numbers, with an accumulator that sums the prime numbers produced.