still having issues


The instructions show that they want the output to be in the following format:

price: 2
stock: 0

Look at your code and how you have the strings laid out. Do they match price: and stock:?

String Formatters with Numbers Tip

The prices and stock are numbers and not strings. Right? Looking at your string formatter, you have:

print "prices : %s" % prices[key]

prices[key] will be a number. That does not directly convert into a string data type. You have 2 choices to make:

  1. Do the conversion using str(prices[key]).
  2. Change the placeholder from %s to %d.

For the 2nd one, %d accepts a signed integer decimal and then converts it into a string for you. You can learn more about the string formatters in the Python documentation.


i did that and im still facing the same issue here.


this is a new error now…what’s happening …am i wrong or is there a bug in this lesson ?


Hi @winston2019,

Make sure the colon ( : ) in your strings is right next to price and stock. :slight_smile:


Done that…no idea where this error is from


Refresh your browser and see what happens. I tested your code and it works fine.


same …which of my codes did you run ?


The one you just posted. Can you copy your code and paste it here in Preformatted text? Thanks :slight_smile:



price = {
“banana”: 4,
“apple”: 2,
“orange”: 1.5,
“pear”: 3

“banana”: 6,
“apple” : 0,
“orange” : 32,
“pear” : 15
for key in price:
print “price : %s” % str(price[key])
print “stock : %s” % str(stock[key])


It’s working now …sorry


It’s alright :slight_smile: I’m glad you got it working :+1:


and then …it stopped:rage:


Okay, well can you post your code again in Preformatted text? Or is it the same code from above.
Also, what error code/s are you getting?


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