Sorting a List of Fruits Alphabetically
๐ Scenario: You have a list of fruits that you want to organize alphabetically, just like arranging books on a shelf in order.
๐ฏ Goal: Learn how to use the sorted() function in Python to sort a list of items alphabetically.
๐ What You'll Learn
Create a list called
fruits with the exact items: 'banana', 'apple', 'cherry', 'date'Create a variable called
sorted_fruits to store the sorted listUse the
sorted() function to sort the fruits listPrint the
sorted_fruits list to show the result๐ก Why This Matters
๐ Real World
Sorting lists is useful when you want to organize items like names, products, or any data alphabetically or by some order.
๐ผ Career
Many jobs require sorting data to make it easier to search, analyze, or display neatly, such as in data entry, programming, or report generation.
Progress0 / 4 steps