Keeping trace of product


Do you what is the problem with my code?

Oops, try again. Check what your code prints for orange. It doesn't look quite right!

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

for items in prices:
print items
print 'Prices: %s' % prices[items]
print 'Stock: %s' % stock[items]

and the result:
Prices: 1.5
Stock: 32
Prices: 3
Stock: 15
Prices: 4
Stock: 6
Prices: 2
Stock: 0

Keeping track of the produce

here print 'Prices:

it should be price without s at the end, and lowercase p

same for stock here:

print 'Stock:

should also with lowercase letters


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