11. New Entries


#1

Needing help ;/

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

Your code here: Add some dish-price pairs to menu!

menu['dish-price pairs'] = 45.60
menu['pairs'] = 45454.56
print menu['dish-price pairs']
print menu['pairs']

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

I've tried everything.


#2

@accollins,

The Instruction::

Add

at least three more key-value pairs

to the menu variable,
with the dish name (as a "string") for the key
and the price (a float or integer) as the value.


#3

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

Your code here: Add some dish-price pairs to menu!

menu['Spam'] = 3.87
print menu['Spam']
menu['Eggs'] = 6.72
print menu['Eggs']
menu['Cheese'] = 7.53
print menu['Cheese']
print "There are " + str(len(menu)) + " items on the menu."
print menu

your code should look like this but you can change the strings and prices


#4

Still saying the same thing with my new code.

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

Your code here: Add some dish-price pairs to menu!

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


#5

@accollins,
You could at least mention the EXACT Oops- or Error message you are getting......


#6

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


#7

So you get the notification


#8

@accollins,
You will have to add
AT LEAST 3
to the existing 1st.....
meaning in the END you would have 4 key-Value pairs !!!!!!


#9

It's fine I already figured it out.


#10

menu['dish-price pairs'] = 45.60
menu['pairs'] = 45454.56
print menu['dish-price pairs']
print menu['pairs']
print "There are " + str(len(menu)) + " items on the menu."
print menu
menu['Spam'] = 2.50

this is your code copy this


#11

this does actually work.. @ethan124174