9. New Entries


#1



9. New Entries

Oops, try again. Make sure to add at least three key-value pairs to menu to complete this exercise!


I thought it would work. What am I doing wrong??


menu = {} # Empty dictionary
menu['Chicken Alfredo'] = 14.50 # Adding new key-value pair
print menu['Chicken Alfredo']


menu['Beef Soup'] = 12.50
print menu['Beef Soup']


menu['Spicy Chicken Soup'] = 13.99
print menu['Spicy Chicken Soup']


print "There are " + str(len(menu)) + " items on the menu."
print menu


#2

To pass the SCT you need to add one more key/value pair like this one,

But with different info of course. :slight_smile:


#3

Oh lol i thought i only needed 3 (including the one that starts there) ok thanks i'll do that now.


#4

Lol no, you just need one more :smile:


#5

It didn't work

menu = {} # Empty dictionary
menu['Chicken Alfredo'] = 14.50 # Adding new key-value pair
print menu['Chicken Alfredo']


menu['Beef Soup'] = 12.50
print menu['Beef Soup']


menu['Spicy Chicken Soup'] = 13.99
print menu['Spicy Chicken Soup']

menu['This is completely random']
print menu['This is completely random']

print "There are " + str(len(menu)) + " items on the menu."
print menu

#6

LOL :sunny: :sunny: :sunny:


#7

What am i doing wrong, This didn't work either??

menu = {} # Empty dictionary
menu['Chicken Alfredo'] = 14.50 # Adding new key-value pair
print menu['Chicken Alfredo']


menu['Beef Soup'] = 12.50
print menu['Beef Soup']


menu['Spicy Chicken Soup'] = 13.99
print menu['Spicy Chicken Soup']

menu['This is completely random']
print menu['This is completely random']

print "There are " + str(len(menu)) + " items on the menu."
print menu

#8

you need to store a decimal value in this one as well like you have done here,


#9

I ment

menu = {} # Empty dictionary
menu['Chicken Alfredo'] = 14.50 # Adding new key-value pair
print menu['Chicken Alfredo']


menu['Beef Soup'] = 12.50
print menu['Beef Soup']


menu['Spicy Chicken Soup'] = 13.99
print menu['Spicy Chicken Soup']

menu['Crazy Soup']
print menu['Crazy Soup']

print "There are " + str(len(menu)) + " items on the menu."
print menu

#10

Ok it worked

menu = {} # Empty dictionary
menu['Chicken Alfredo'] = 14.50 # Adding new key-value pair
print menu['Chicken Alfredo']


menu['Beef Soup'] = 12.50
print menu['Beef Soup']


menu['Spicy Chicken Soup'] = 13.99
print menu['Spicy Chicken Soup']

menu['Crazy Soup'] = 12
print menu['Crazy Soup']

print "There are " + str(len(menu)) + " items on the menu."
print menu

#11

But you can't do this

menu = {} # Empty dictionary
menu['Chicken Alfredo'] = 14.50 # Adding new key-value pair
print menu['Chicken Alfredo']


menu['Beef Soup'] = 12.50
print menu['Beef Soup']


menu['Spicy Chicken Soup'] = 13.99
print menu['Spicy Chicken Soup']

menu['Crazy Soup'] = 0.0.0.0.0.0.0.0.0
print menu['Crazy Soup']

print "There are " + str(len(menu)) + " items on the menu."
print menu

#12

OK im changing that LOL
Edited
Edited


#13

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