Prime numbers list generator immediately closing when run

前端 未结 2 844
余生分开走
余生分开走 2021-01-07 17:23

I\'m trying to make a list of prime numbers.

primes = []
num=int
for num in range (2,100):
    for x in range (2, num):
        if (num % x) == 0:
                   


        
2条回答
  •  被撕碎了的回忆
    2021-01-07 18:01

    The logic in your if-else is incorrect.

    If you get a "clean modulo" in your if block, what do you want to happen? Hint: not pass.

    Second, when do you want to append to your prime list?

    Not being too specific here as we shouldn't be doing this H/W assignment for you. :)

提交回复
热议问题