Keeping Track of the Produce:A day at supermarket


Keeping Track of the Produce

it says
Traceback (most recent call last):
File "python", line 18, in
TypeError: not all arguments converted during string formatting

I think I have written the code perfectly! It should be running!

prices= {
    'banana': 4,
    'apple': 2,
    'orange': 1.5,
    'pear': 3

stock= {
     'banana': 6,
    'apple': 0,
    'orange': 32,
    'pear': 15    

for key in prices:
    print key
    print "price: &s" % prices[key]
    print "stock: &s" % stock[key]


Hi these lines

    print "price: &s" % prices[key]
    print "stock: &s" % stock[key]

these parts

    print "price: &s" 
    print "stock: &s"

instead of & you should put %


Thank you so much! I'm so foolish to not notice that!


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