python123 job - Primes and seek within 100

description

Within all seek Primes and 100 and outputs.

It refers to the prime number greater than 1, and can only be an integer divisible and their 1.

Tip: Analyzing each individually be less than the number 100 is prime, then summed.

 

#Prime
def is_prime(n):
    for i in range(2,n):
        if n%i == 0:
            return False
    return True
sum = 0
for i in range(2,100):
    if is_prime(i):
        sum += i
print(sum)

  

Guess you like

Origin www.cnblogs.com/starboy13/p/12554919.html