182k views
5 votes
Write an application that displays the strings in the provided array alphabetically in ascending order.

User Locane
by
2.6k points

1 Answer

6 votes

Answer:

Step-by-step explanation:

The following code is written in Python and it is a very simple function/program that takes in an array of strings as a parameter called names. This array is then passed the built-in sort function which automatically sorts it in ascending alphabetical order. Finally, the print method is called on the names array to print all of its elements out.

def sort_strings(names):

names.sort()

print(names)

User Jacqueline Nolis
by
3.7k points