python求素数示例分享
时间:2021-06-16 12:01:48
# 判断是否是素数
def is_sushu(num):
res=True
for x in range(2,num-1):
if num%x==0:
res=False
return res
return res
# 打印出素数列表
print ([x for x in range(1000) if is_sushu(x)])
标签:python,素数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
如何用C代码给Python写扩展库(Cython)
2023-06-08 17:06:32
![](https://img.aspxhome.com/file/2023/6/72166_0s.jpg)
八卦调侃Reset CSS
2010-01-13 13:01:00
pygame可视化幸运大转盘实现
2021-03-01 05:22:11
![](https://img.aspxhome.com/file/2023/7/79607_0s.png)
python实现批量命名照片
2021-11-03 18:07:42
![](https://img.aspxhome.com/file/2023/3/77043_0s.png)
24式加速你的Python(小结)
2023-09-25 10:25:24
![](https://img.aspxhome.com/file/2023/2/62572_0s.png)
PHP中curl_setopt函数用法实例分析
2023-11-22 22:07:22
为导入文件加上时间戳标记的两种方法
2009-01-07 14:14:00
用python爬取历史天气数据的方法示例
2022-10-30 21:28:42
![](https://img.aspxhome.com/file/2023/3/68863_0s.png)
框架布局慎用元素
2008-12-21 16:33:00
ASP经常用到的函数
2009-07-06 13:00:00
widows下安装pycurl并利用pycurl请求https地址的方法
2023-07-09 03:21:18
![](https://img.aspxhome.com/file/2023/4/61204_0s.jpg)
Python selenium环境搭建实现过程解析
2023-10-06 06:18:48
![](https://img.aspxhome.com/file/2023/1/63271_0s.png)
asp如何读取服务器上的驱动器?
2009-11-18 20:50:00
再谈 Web 默认字体
2009-11-24 12:48:00
ASP连接MySQL数据库的方法
2010-03-14 11:25:00
jQuery中$.ajax的实现解析
2008-07-20 13:11:00
如何实现网上站点维护?
2010-05-24 18:35:00
Python 中导入文本文件的示例代码
2021-04-18 04:53:01
深入了解Python的异常处理机制
2023-09-03 09:25:41
![](https://img.aspxhome.com/file/2023/6/68886_0s.png)
Python linecache.getline()读取文件中特定一行的脚本
2023-03-09 13:18:05
![](https://img.aspxhome.com/file/2023/5/67725_0s.gif)