Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Python: Sorting a List

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

alist = [10, 2, 8]

# Returns sorted list of input list
blist = sorted(alist)

# In-place sort of list
alist.sort()

© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email