Section 8


#1


https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/1/3?curriculum_id=4f89dab3d788890003000096

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

No idea what is wrong here


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

for fruit in prices:
    print fruit
print "price: %d" %prices[fruit]
print "stock: %d" %stock[fruit]


#2

Hi this part

for fruit in prices:
    print fruit
print "price: %d" %prices[fruit]
print "stock: %d" %stock[fruit]

You should indent your second and third print statement like the first print .


#3

Thanks that helped but orange isnt printing 1.5
prices= {"banana":4,"apple":2,"orange":1.5,"pear":3}
stock={
"banana":6,
"apple":0,
"orange":32,
"pear":15
}

for fruit in prices:
print fruit
print "price: %d" %prices[fruit]
print "stock: %d" %stock[fruit]
all the prints are indented


#4

Its because you use %d which print the integer of the number you should use %s` wich will print you also the float number.


#5

Thank you so much that fixed it