Here, we learn how to find out the N largest and smallest elements from the list? Where, list and N given by the user, N may be any value but less than the list length.
在这里,我们学习如何从列表中找出N个最大和最小的元素? 其中, 列表和用户给定的N , N可以是任何值,但小于列表长度。
Description:
描述:
There are two ways,
有两种方法,
1. By defining a function:
1.通过定义一个函数:
Procedure:
程序:
Define the function name largest_ele and smallest_ele.
定义函数名largest_ele和smallest_ele。
Pass two arguments in a function (l,n) : l is the list and n