python输出300到800的素数并每行5个输出
时间: 2023-06-05 17:08:44 浏览: 89
python 实现100到200的素数
5星 · 资源好评率100%
Sure, I can do that for you. Here is the code:
```python
def is_prime(num):
if num < 2:
return False
for i in range(2, int(num**0.5)+1):
if num % i == 0:
return False
return True
count = 0
for num in range(300, 801):
if is_prime(num):
print(num, end="\t")
count += 1
if count % 5 == 0:
print()
```
Hope it helps!
阅读全文