在 Python 中追加()和扩展()
原文:https://www.geeksforgeeks.org/append-extend-python/
追加 : 将其参数作为单个元素添加到列表的末尾。名单的长度增加了一个。
syntax:
# Adds an object (a number, a string or a
# another list) at the end of my_li
七、排序及其应用
排序是一种非常常见的算法,我们用它来按照升序或降序重新排列数字或对象的列表。排序更具技术性的定义如下:
In computer science, a sorting algorithm is an algorithm that puts elements of a list in a certain order.
现在,让我们假设您有一个 n 项的列表,并且您想要对它们进行排序。