DeveloperBreeze

The following Python code demonstrates how to sort a list of fruits alphabetically using the sort() method:

# Define a list of fruits
fruits = ['apple', 'banana', 'cherry', 'date', 'fig']

# Sort the list alphabetically
fruits.sort()
print('Sorted Fruits:', fruits)

Continue Reading

Handpicked posts just for you — based on your current read.

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!