1: for i in range(2,num): if (num%i) == 0: break else: print(num)..._创建一个方法,实现输入一个最小值和一个最大值,打印输出这个区间内所有的素数。">
赞
踩
lower = int(input("输入区间最小值:"))
upper = int(input("输入区间最大值:"))
for num in range(lower+1,upper):
if num>1:
for i in range(2,num):
if (num%i) == 0:
break
else:
print(num)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。