0
我正在学习python,我试图使用我构建的这个函数,它不工作。尽管它应该这样做,但函数并没有改变字典中的单个值,因为它正在工作。我想获得一些帮助如何减去python字典中的键的值
def delete_product(diction):
product_to_delete = raw_input()
for key,value in diction.items():
if key == product_to_delete:
value = value - 1
if (value == 0):
del diction[key]
print "removed"
raw_input()
print "we couldnt remove the product because it does not exist"
raw_input()