- 博客(3)
- 收藏
- 关注
转载 python中的除法
从python2.2开始,便有两种除法运算符:"/"、"//"。两者最大区别在:python2.2前的版本和python2.2以后3.0以前的版本的默认情况下,"/"所做的除法是以一种两个数或者多个数出现一个浮点数结果就以浮点数的形式表示,即float除法"//"所做的除法则不相同,"//"不管两者出现任何数,都以整除结果为准,不对小数部分进行处理,直接抛弃,也就是整除法以下是笔者在编译...
2019-09-11 17:23:18
6482
原创 python list.sort()和sorted()方法
list.sort()方法list.sort(key=None, reverse=False)其中key用于指定列表元素的权重,key=函数名,函数的返回值对应于元素的权重。reverse=False,默认排序方式是升序。list.sort()方法直接对list进行排序修改,无返回值。例如对时间列表进行降序排序:timestamp = [ "2010-04-20 10:07:3...
2019-09-11 15:12:10
202
原创 leetcode算法题(python实现):TwoSum
题目描述题目链接Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use ...
2019-09-11 11:33:03
215
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人