I have a problem with this code... it works on PyCharm but not in the website just in case pycharm is in python 3.5.1


#1

user_lookfor = input('please intruduce what you looking for.... ')

prices = {
'banana':4,
'apple':2,
'orange':1.5,
'pear':3
}
stock = {
'banana':6,
'apple':0,
'orange':32,
'pear':15
}
for key in prices:
if user_lookfor == key:

    print(key)
    print('the price is %s' %prices[key] )
    print('and we have %s' % stock[key])

#2

Hi It's because The Lesson want You To print It like that

banana
price: 4
stock: 6

#5

user_lookfor = input('please intruduce what you looking for....')
prices = {
'banana':4,
'apple':2,
'orange':1.5,
'pear':3
}
stock = {
'banana':6,
'apple':0,
'orange':32,
'pear':15
}
for key in prices:
if user_lookfor == key:

    print(key)
    print('price: %s' %prices[key] )
    print('stock: %s' % stock[key])

i make the changes and still dont work

this is the messeges error

please intruduce what you looking for.... apple
Traceback (most recent call last):
File "python", line 1, in
File "", line 1, in
NameError: name 'apple' is not defined


#6

HI you don't need of a if statement inside your for loop... the same for the input()