Keeping trace of product


#1

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:
orange
Prices: 1.5
Stock: 32
pear
Prices: 3
Stock: 15
banana
Prices: 4
Stock: 6
apple
Prices: 2
Stock: 0


Keeping track of the produce
#2

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


#4

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