[training] Python – 質數

num = int(input("Please input a number: "))

for i in range(2, num):
    for j in range(2, i):
        if (i % j == 0):
            break
        
        if (i == j + 1):
            print(i)

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.