代码不返回所有列表数组

Code not returning all list arrays

我编写了以下代码,与您的略有不同:

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.")

但由于某种原因它只有 returns 一件商品缺货,当有两件时:

抱歉,钢笔缺货。 将纸张添加到您的购物车 将墨水添加到您的购物车 您的订单已完成。

我做错了什么?

您在第一行的 'ink ' 字符串中多了一个 space。 'ink' != 'ink '