Python入门自检
来源:互联网 发布:java可变长参数 使用 编辑:程序博客网 时间:2024/05/22 04:49
本来想写一个回数的filter的筛选函数,但是想法很好,过程一直出错,改的累,函数先留下,之后学习学习再回来解决这个问题
#回数
#找不出哪里出错了,好难受
def _is_shuzu():
n=1
while 1:
n=n+1
yield n
def _not_divisible(n):
return str(n)==str(n)[::-1]
def is_palindrome():
it=_is_shuzu()
while 1:
n=next(it)
yield n
it=filter(_not_divisible(n),it)
for n in is_palindrome():
if n<1000:
print(n)
else:
break
明明感觉应该是可以的,留念吧
阅读全文
0 0
- Python入门自检
- 系统自检-FLASH自检
- 内存自检
- 自勉,自检。
- acm 自检
- 开机自检
- BIOS自检
- 开机自检
- STM32自检
- 项目自检
- tomcat自检
- 问题自检
- Python入门
- python入门
- Python入门
- Python入门
- Python入门
- Python入门
- 《Java并发编程的艺术》第四章——Java并发编程基础
- ZooKeeper 原理及其在 Hadoop 和 HBase 中的应用
- 递归思想和实例
- linux wget 命令用法详解(附实例说明)
- 浅谈Java中的hashcode方法
- Python入门自检
- 深耕网站安全防护技术研究的智恒再获奖项
- hexo创建新博客后自动打开
- solr6.X 404 403 问题总结
- Unity2017.3来了!洪流学堂第一时间送上更新日志简报
- 『React 开发』学习用 Ant Design 做后台系统
- Python3 字符编码
- html5浏览器缓存 localStorage 之LsyStorage.js插件的使用
- C++字符串处理 kevin_xcw