【Python学习日记】判断是不是回文数 filter
2016-06-25 23:00
309 查看
大神答案:
def is_palindrome(n):
n=str(n)
m=n[::-1]
return n==m
我的答案:
def is_palindrome(n):
n=str(n)
m=n[::-1]
return n==m
我的答案:
tmp_str = str(n) i = len(tmp_str) - 1 j = 0 while i > j : if tmp_str[i] == tmp_str[j] : i = i - 1 j = j + 1 pass else : return False return True
相关文章推荐
- 数据预处理系列:(五)分类变量处理
- Python GUI
- Python 多线程 多进程 GIL
- 【Python】 Missing parentheses in call to 'print'
- 【Python学习日记】map/reduce
- Python基本知识 os.path.join
- Spark机器学习笔记1--Spark Python编程入门
- 栈(Stack)的python实现及应用
- Python学习-baseNo.2
- Python代码项目目录规范v1.0
- python代码风格规范
- python中HTMLParser简单理解
- 几个用Python实现的简单算法
- python正则替换
- python之class(1)
- 利用python进行数据分析-数据聚合与分组运算1
- Python(1)
- Python的由来
- 基于布尔注入的Python代码
- 基于报错注入的Python代码