python的min()函数也可用于比较tuple
python的min()函数也可用于比较tuple
>>> a = (2,'asv','dfg')
>>> b = (3,'gsg','weg')
>>> c = (5,'bad','ser')
>>> min(a, b, c)
(2, 'asv', 'dfg')
>>>
这是官方文档
min(iterable[, key])min(arg1, arg2, *args[, key])
Return the smallest item in an iterable or the smallest of two or more arguments.
If one positional argument is provided, iterable must be a non-empty iterable (such as a non-empty string, tuple or list). The smallest item in the iterable is returned. If two or more positional arguments are provided, the smallest of the positional arguments is returned.
The optional key argument specifies a one-argument ordering function like that used for list.sort(). The key argument, if supplied, must be in keyword form (for example, min(a,b,c,key=func)).
Changed in version 2.5: Added support for the optional key argument.
python的min()函数也可用于比较tuple的更多相关文章
- Python中split()函数的用法及实际使用示例
Python中split()函数,通常用于将字符串切片并转换为列表. 一.函数说明: split():语法:str.split(str="",num=string.count(st ...
- Python之路(第八篇)Python内置函数、zip()、max()、min()
一.python内置函数 abs() 求绝对值 例子 print(abs(-2)) all() 把序列中每一个元素做布尔运算,如果全部都是true,就返回true, 但是如果是空字符串.空列表也返回t ...
- Python之路Python内置函数、zip()、max()、min()
Python之路Python内置函数.zip().max().min() 一.python内置函数 abs() 求绝对值 例子 print(abs(-2)) all() 把序列中每一个元素做布尔运算, ...
- python中format函数用于字符串的格式化
python中format函数用于字符串的格式化 通过关键字 print('{名字}今天{动作}'.format(名字='陈某某',动作='拍视频'))#通过关键字 grade = {'name' : ...
- Python内置函数(43)——min
英文文档: min(iterable, *[, key, default]) min(arg1, arg2, *args[, key]) Return the smallest item in an ...
- 包含min函数的栈(python)
题目描述 定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度应为O(1)). # -*- coding:utf-8 -*- class Solution: #入栈时 ...
- python剑指offer 包含min函数的栈
题目描述 定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度应为O(1)). # -*- coding:utf-8 -*- class Solution: def ...
- 20.包含min函数的栈(python)
题目描述 定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度应为O(1)). # -*- coding:utf-8 -*- class Solution: def ...
- 剑指offer-包含min函数的栈-栈和队列-python
题目描述 定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度应为O(1)). # -*- coding:utf-8 -*- class Solution: de ...
随机推荐
- linux驱动开发之GCC问题
最近正在学习驱动开发,进展到字符设备驱动开发阶段. 先不多说,首先把刚看的一篇学习驱动步骤的帖子记录如下: 1. 学会写简单的makefile 2. 编一应用程序,可以用makefile跑起来 3. ...
- SSH服务及花生壳域名解析
一.安装说明以CentOS 5为例 1.安装必要的开发包 [root@localhost ~]# yum install gcc gcc-c++ autoconf automake 2.下载phddn ...
- PHP小题目 求 1*3+5*7+…+97*99的值
下面是另外两种比较基础的方法实现的代码
- 【Android - 框架】之XBanner的使用
一.XBanner简介 XBanner是一个非常优秀的无限自动轮播框架,也是一个控件.这里是XBanner的GitHub地址 XBanner的主要功能如下: 根据传入的数据条数自动调整广告页数 当图片 ...
- 使用JUnit测试java代码
Junit 单元测试实验报告 一.实验环境 MyEclipse2014.Junit4.10 二.实验目的 学会单元测试,在MyEclipse中进行Junit测试 三.实验步骤 1.写出要测试的类 代 ...
- BFS-hdu-4101-Ali and Baba
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4101 题目大意: 给一个矩阵,0表示空的可走,-1宝藏的位置(只有一个),其余的正整数表示该位置石头 ...
- Memo打印
加入Printers单元, ; Left ; y ;; do begin Printer.Canvas.TextOut(x,y,Memo1.Lines[i]) ...
- android tips—启动Emergency call拨号盘
Intent intent = new Intent(); intent.setAction("com.android.phone.EmergencyDialer.DIAL"); ...
- android 22 启动带2个action值的预定义acticity
main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" andro ...
- iOS-UITouch,UIEvent使用介绍
UITouch 当用户用一根手指触摸屏幕时,会创建一个与手指相关联的UITouch对象 一根手指对应一个UITouch对象 UITouch的作用 保存着跟手指相关的信息,比如触摸的位置.时间.阶段 当 ...