Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (47.6k points)

What is the best way of creating an alphabetically sorted list in Python?

1 Answer

0 votes
by (106k points)

The easiest way is to use sorted() function that sorts a list of string. The sorted() function modifies your original list to get a sorted copy of the list, without changing the original list below is an example that illustrates the use of shorted() function:-

mylist = ["a", "d", "B"]

for x in sorted(mylist):



Related questions

0 votes
1 answer
0 votes
1 answer
asked Aug 1, 2019 in Python by Sammy (47.6k points)
0 votes
2 answers
asked Jul 22, 2019 in Python by Sammy (47.6k points)

Browse Categories