def isprime(a):
sum = 0
x = 1
if(a % x == 0):
sum += x
x += 1
if (a + 1 == sum):
return True
elif (a + 1 != sum):
return False
return True
for num in range (1, 101):
if(isprime(a) == True):
print(a)
答案 0 :(得分:1)
你的循环变量是'num'
,而不是'a'
:
for num in range (1, 101):
if isprime(num):
print(num)