Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lists.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1043,3 +1043,18 @@
"nbformat": 4,
"nbformat_minor": 2
}

places = ["China", "Korea", "France", "Brazil", "Costa Rica"] #places to visit
print("Original List:", places) #printed original list
print("Alphabetical order:", sorted(places)) #print alphabetical list
print("Still original list:", places) #show list in original order by printeing it
print("Reverse alphabetical order:", sorted(places, reverse=True)) #print in reverse alphabetical order
print("Still original list:", places) #show list in original order by printeing it
places.reverse() #use reverse to change over of list
print("Reversed list:", places) #print to show order has changed
places.reverse() #use reverse to change over of list again
print("Back to original order:", places) #print to show order is back to original
places.sort() #sort list alphabetically
print("Permanently sorted list:", places) #print to show above is true
places.sort(reverse=True) #store in reverse alphabetical order
print("Permanently reverse sorted list:", places) #print to make sure above is true