8. Keeping track of the produce


#1

This is the link to my code page:
https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/1/3?curriculum_id=4f89dab3d788890003000096

I ran the code and there is error message like this:

Oops, try again.
You should have exactly three print statements! (Make sure there are no occurrences of 'print' in any comment or string!)

I have browsed several posts in this topic and crossed check with my codes (to avoid overlapping topic) but it seems that I have not seen ant topic with same problem. Can you help me? Thank you


# Creats price list
prices = {
    "banana": 4,
    "apple": 2,
    "orange": 1.5,
    "pear": 3,
    }

#Create stock list
stock = {
    "banana": 6,
    "apple": 0,
    "orange": 32,
    "pear": 15
    }

#Loop to print price and stock for each fruit
for fruit in prices:
    print fruit
    print "price: %s" % prices[fruit]
    print "stock: %s" % stock[fruit]


#2

are your comments in the code you submitted as well? there's a "print" word in your last comment you need to remove the word "print" in that comment.


#3

Oh...yes I worked, after I removed the word "print".
I thought that what is written after the # sign is not counted.
Thank you for your help. I have learned more than what I asked :smiley:


#4

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