Your quest today is to explore the Holy Grail Inventory, a legendary collection of absurdly powerful (and occasionally ridiculous) items from the world of Monty Python and the Holy Grail.
Hidden within this program is a list of lists — each item contains multiple pieces of information packed together like a medieval knapsack. Your job is to unpack those values correctly and use them to display information, make selections, and avoid catastrophic program crashes (no one likes a surprise Holy Hand Grenade).
In this activity, you will work with a list of lists that stores information about several “Holy Grail” items. Each item contains multiple values (name, description, and damage stats), and your goal is to unpack those values correctly and use them in the program.
🔹 Loop through a list of items and unpack each item into variables
🔹 Display item data in a clean, readable table
🔹 Allow the user to select an item by number
🔹 Unpack the selected item and display its name and description
🔹 Keep the program running until the user chooses to quit
🔹 Use try / except to prevent the program from crashing when bad input is entered
Each item in holy_grail_items is a list with four values, always in the same order:
🏷️ Item Name
📜 Item Description
💥 Maximum Damage
⚔️ Minimum Damage
When you loop through the list, Python lets you unpack these values directly into variables — no messy indexing required. If you understand unpacking, your code becomes cleaner, clearer, and far more knightly.
The print_items() function displays all available items in a neatly formatted table. This part of the quest focuses on:
Looping through a list of lists
Unpacking each item into meaningful variables
Formatting output so it actually looks readable (a rare but powerful skill)
If the table prints correctly, congratulations — you have not been taunted by the French (yet).
Once the list is displayed, the user can:
Enter a number to select an item
View the item’s name and dramatic description
Continue selecting items until they choose to quit
Behind the scenes, your program:
Uses list indexing with user input
Unpacks the selected item into variables
Uses try/except to prevent the program from exploding when bad input appears (much like the Black Knight)
🏆 Bonus Task 1 (+10): Display the selected item’s name and description
🏆 Bonus Task 2 (+10): Let the user keep selecting items until they quit
🏆 Bonus Task 3 (+10): Prevent crashes using try/except