帮我补全这串代码,def main(): m,n =input("输入m,n:").split(",") m, n = int(m), int(n) if m <= 0 or n <= 0 print(“输入不是正整数!” else: if m > n: m,n = n, mcount =_[4]if count == 0: print("不存在素数!”) main(0)
时间: 2023-05-12 07:03:18 浏览: 160
py代码-01
def main():
m, n = input("输入m,n:").split(",")
m, n = int(m), int(n)
if m <= 0 or n <= 0:
print("输入不是正整数!")
else:
if m > n:
m, n = n, m
count = 0
for i in range(m, n+1):
if i == 2:
count += 1
elif i > 2:
for j in range(2, int(i**0.5)+1):
if i % j == 0:
break
else:
count += 1
if count == 0:
print("不存在素数!")
else:
print("素数的个数为:", count)
main()
阅读全文