Error in lesson(Keeping Track of the Produce)


#1

Dear Sir,
I got error on below code. This code is to create loop to find stock and prices form two separate function, which i did correctly but i don't know why it's showing this error for "orange" key(
Oops, try again. Check what your code prints for orange. It doesn't look quite right!) and how keys will take in looping? Can just elaborate for me plz....

My codes:

prices={"banana":4,"apple":2,"orange":1.5,"pear":3}
stock={"banana":6,"apple":0,"orange":32,"pear":15}

for i in prices:
    print(i)
    print ("price: %s"%prices[i])
    print("stock:  %s"%stock[i])

My regards,
TBIKU


#2

you have two spaces between stock: and %s, this should be a single space


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.