Array sorting and reversing
📖 Scenario: You work in a small bookstore. You have a list of book titles that customers want to buy. You want to organize this list to make it easier to find books.
🎯 Goal: You will create a list of book titles, then sort them alphabetically, and finally reverse the order to see the list from Z to A.
📋 What You'll Learn
Create an array called
books with the exact titles: 'Ruby Basics', 'Learn Rails', 'JavaScript Guide', 'Python Essentials', 'Data Science'Create a variable called
sorted_books that holds the books array sorted alphabeticallyCreate a variable called
reversed_books that holds the sorted_books array reversedPrint the
reversed_books array💡 Why This Matters
🌍 Real World
Sorting and reversing lists is common when organizing data like product names, customer lists, or any collection of items.
💼 Career
Many programming jobs require you to manipulate lists and arrays efficiently to prepare data for display or further processing.
Progress0 / 4 steps