Sort List of Strings in Python (Example) | Reverse Order of Items | Ascending & Descending Ordering

Published: 05 April 2023
on channel: Statistics Globe
212
9

How to sort a list of strings in the Python programming language. More details: https://statisticsglobe.com/sort-list...
This tutorial was created in collaboration with Ömer Ekiz: https://statisticsglobe.com/oemer-ekiz
Python code of this video:

string_list = ["Statistics", "Data", "Science", # generating an example float list
"Python", "String", "Hello"]
print(string_list) # print example list

string_list.sort() # sorting the list ascending
print(string_list) # printing the sorted list
['Data', 'Hello', 'Python', 'Science', 'Statistics', 'String']

string_list.sort(reverse=True) # sorting the list descending
print(string_list) # printing the sorted list
['String', 'Statistics', 'Science', 'Python', 'Hello', 'Data']

Follow me on Social Media:
Facebook – Statistics Globe Page:   / statisticsglobecom  
Facebook – R Programming Group for Discussions & Questions:   / statisticsglobe  
Facebook – Python Programming Group for Discussions & Questions:   / statisticsglobepython  
LinkedIn – Statistics Globe Page:   / statisticsglobe  
LinkedIn – R Programming Group for Discussions & Questions:   / 12555223  
LinkedIn – Python Programming Group for Discussions & Questions:   / 12673534  
Twitter:   / joachimschork  

Music by bensound.com


Watch video Sort List of Strings in Python (Example) | Reverse Order of Items | Ascending & Descending Ordering online without registration, duration hours minute second in high quality. This video was added by user Statistics Globe 05 April 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 21 once and liked it people.