Using Membership Operators (in, not in) in Python
📖 Scenario: You work at a library. You have a list of books currently available on the shelves. You want to check if certain books are in the library or not.
🎯 Goal: Build a small program that checks if some books are available in the library using membership operators in and not in.
📋 What You'll Learn
Create a list called
library_books with exact book titlesCreate a variable called
check_book with a specific book titleUse
in or not in to check if check_book is in library_booksPrint the result as a sentence
💡 Why This Matters
🌍 Real World
Libraries, stores, and many apps need to check if an item is available in a collection before proceeding.
💼 Career
Understanding membership operators helps in filtering data, validating inputs, and controlling program flow in many programming jobs.
Progress0 / 4 steps