Human-readable error messages
📖 Scenario: You are building a simple REST API that returns data about books. When something goes wrong, you want to send clear, easy-to-understand error messages to the user instead of confusing technical errors.
🎯 Goal: Create a small API simulation that returns human-readable error messages for common problems like missing data or invalid input.
📋 What You'll Learn
Create a dictionary called
books with three book entries and their authorsCreate a variable called
requested_book with the name of the book to searchWrite code to check if
requested_book is in books and handle errors with clear messagesPrint the result or the error message
💡 Why This Matters
🌍 Real World
APIs often need to tell users what went wrong in a way they can understand, instead of showing confusing technical errors.
💼 Career
Clear error messages improve user experience and are important for developers working on web services and APIs.
Progress0 / 4 steps