I wrote the following code which is a slight variation to yours:
shopping_cart = ['pen', 'paper ', 'ink '] #items in shopping cart
out_of_stock = ['pen', 'ink'] #items out of stock
for item in shopping_cart:
if item in out_of_stock:
print ("Sorry, " + item + " is out of stock.")
else:
print ("Adding " + item + " to your shopping cart")
print ("Your order is complete.")
but for some reason it only returns one item out of stock, when there are two:
Sorry, pen is out of stock. Adding paper to your shopping cart Adding ink to your shopping cart Your order is complete.
What am I doing wrong?