求会 python 的大神

来源:百度知道 编辑:UC知道 时间:2024/05/26 10:13:41
题目:Write Python code for finding both the largest and the smallest integers in a finite sequence of integers.用python代码在有限的整数序列里找到最大和最小的整数

li = [1, 32, 2, 56, 18]

li.sort(cmp=None, key=None, reverse=False)

uMinNum = li[0]

li.sort(cmp=None, key=None, reverse=True)

uMaxNum = li[0]

-----------------------------------------

li是一个列表,用列表存储这些数据, 然后用列表的排序方法sort()。

li.sort(cmp=None, key=None, reverse=False)也可以写成li.sort(), 因为sort()函数的原形就是这样。默认的为是升序排序。

li.sort(cmp=None, key=None, reverse=True)修改sort()的reverse变量, 让sort()进行降序排序。 

li[0] 是取排好序后的第一个元素

会python的教我。。。郁闷中。。。 急求!!!法律专业的大神们!!! python的版本不同会有什么结果 求跳大神 歌词 python的问题!!!!!! 用python的人咋这少呢?! python语言的用途? 求Python中文学习网站? 跪求中国古代最有来头的大神~善恶都行!!~~ 大神的问题~~~