Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Python: Sorting a List

📅 2010-Feb-05 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ lists, python, sorting ⬩ 📚 Archive

alist = [10, 2, 8]

# Returns sorted list of input list
blist = <strong><a href="http://docs.python.org/library/functions.html#sorted">sorted</a></strong>(alist)

# In-place sort of list
alist.<strong>sort</strong>()

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧