Keeping Track of the Produce


#1

This is the problem, I don't know why its doing it.


#2

Hi try to remove the uppercase S and P to stock and price in your for loop


#3

@owencarey ,

I believe @wizmarco is correct, you have the wrong case, so just make sure next time.

Next time you make a help request, please also post the raw code, as well as the error, instead of an image. It will be a lot easier for helpers to read it and answer. Thanks. :slight_smile:


#4

Ah cheers guys, that really helped.


#5

But,even though I don't have the uppercase s and p,it still doesn't work...


#6

Maybe post your code so your problem can be seen


#7

I am sorry.I found where I am wrong.It's because I print "prices":disappointed_relieved:a little embarraassed.


#8

I have gotten the error.I print a extra s in price


#9

Oh so your code works now?


#10

yes!just remove the "s" in my print. Thank u all the same ! so kind of u!


#11

No problem :slight_smile:


#12

still its not coming ....it gives [
Oops, try again. Check what your code prints for orange. It doesn't look quite right]
what to do


#13

please post your code @rudrapatel5417


#14

Hi people :slight_smile:


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

for fruits in prices:
print fruits
print "prices: %s" % prices[fruits]
print "stock: %s" % stock[fruits]


dun know wat im doing wrong :frowning: help!


#15

i think your mistake is in spell dont write capital word by the way its work fine
prices = {
"banana": 4,
"apple": 2,
"orange": 1.5,
"pear": 3
}

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

for k in prices:
print (k)
print "price: %s" % prices[k]
print "stock: %s" % stock[k]


#16

thats the correct one

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

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

for k in prices:
print (k)
print "price: %s" % prices[k]
print "stock: %s" % stock[k]


#17

Thank you friend ....for guiding me
:relaxed:


#18

you most wellcome.....


#20

To print the numbers 4, 2, 1.5, 3 etc why are we using %s? We use %s for strings but here we have used %s for numbers.


#21

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

prices ={"banana": 6,
"apple": 0,
"orange": 32,
"pear": 15
}
for key in prices:
print key
print "prices: %s" % prices[key]
print "stock: %s" % stock[key]