def is_prime(number):
if number == 2 or number == 3:
return True
elif(number == 1):
return False
else:
for i in range(2, number):
if number % i == 0:
return False
else:
return True
return True
def print_prime(begin, end):
print("Primes number have:\n")
for number in range(begin,end+1):
if is_prime(number):
print(f"{number} ")
begin = 1
end = 100
print_prime(begin,end)
[提取区间素数]Python
最新推荐文章于 2023-06-04 04:21:14 发布