Skip to content

Commit fc87853

Browse files
Sentioushuangsam
andauthored
Update list.py (huangsam#120)
* Update list.py Added sorting to lists * Update list.py * Update list.py --------- Co-authored-by: Samuel Huang <samhuang91@gmail.com>
1 parent d46985e commit fc87853

File tree

1 file changed

+5
-0
lines changed
  • ultimatepython/data_structures

1 file changed

+5
-0
lines changed

ultimatepython/data_structures/list.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ def main():
8787
lengthy.pop() # pop out the 4 from the back
8888
assert lengthy == [0, 1, 2, 3]
8989

90+
# Let's sort this list in ascending order
91+
numbers = [5, 4, 3, 2, 1]
92+
numbers.sort()
93+
assert numbers == [1, 2, 3, 4, 5]
94+
9095

9196
if __name__ == "__main__":
9297
main()

0 commit comments

Comments
 (0)