Using the code here, how would I change the value of stock for all the products with newstock?
products = {
"apple": {"price": 3.5, "stock": 134},
"banana": {"price": 6.82, "stock": 52},
"cake": {"price": 23, "stock": 5}
}
newstock = input("Enter amount to set :")
I assume a for loop like this would work
for x in products:
products []["stock"]=newstock
But I'm not sure what to put in the empty []