Python - 質數檢查


import math
def prime(num):
    j = 2
    while j<=math.sqrt(num):
        if(num % j == 0):
            return False
        j += 1
    return True
for i in range(2,101):
    if prime(i):
        print(i,'is prime number')

雅思寫作11/10

  example resulted from chatgpt The line graph illustrates the monthly sales of four bakery products—baked bread, croissants, cupcakes, and ...