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


#1

I've spent hours on this and it keeps telling me "
Oops, try again. You should have exactly three print statements! (Make sure there are no occurrences of 'print' in any comment or string!)"

here's my code, please tell me what's wrong

prices = {
"banana":4,
"apple":2,
"orange":1.5,
"pear":3}
stock = {
"banana":6,
"apple":0,
"orange":32,
"pear":15}
for fruits in prices :
# print " %s %s %s" %(fruits, prices[fruits], stock[fruits])
#^^ that was a failed attempt. This format looks cleaner IMO until I realized it was not what they were looking for
print fruits
print "price: %s"%prices[fruits]
print "stock: %s"%stock[fruits]


#2

Hi,

remove the comment in your for loop and try it again. If that doesn't work let me now.


#3

wow no @$% way
thanks! it actually worked
why is there an error as long as I have that comment?


#4

It's not an programming error. Codecademy just checks how often the word print occurs in your code to make sure you followed the instructions properly.

Otherwise people would maybe use 9 print statements instead of using a loop. This way they try to make sure everyone understands how to use a loop to do this.


#5

ohh so it also counted the "print" that was in my comment, so it saw that I typed print 4 times instead of 3.
I see.. lol. Thanks so much!