← back to unit
Easy
# searching easy
Is the Snack Sold Out?
The school snack bar posts a list of everything still in stock. 🥨
You get the list of snacks still available and the target snack you're craving. Print sold out if it is NOT on the list, or in stock if it is.
Example:
Input: snacks = ["pretzel", "apple", "cookie"], target = "cookie"
Output: in stock
cookie shows up in the list, so we print in stock.
Input: snacks = ["pretzel", "apple"], target = "pizza"
Output: sold out
pizza never appears in the list, so we print sold out.
💡 need a hint?
srch-snack-sold-out.py🔒 given lines are locked — write your code in between
loading...