Tuesday, August 12, 2014

Day 129

Python at CodeCademy. Worked on Python tutorial 11 of 14, Python Lists and Dictionaries: New Entries! Worked on how dictionary lists are "mutable".

The code used:
menu = {}
menu['Chicken Alfredo'] = 14.50
print menu['Chicken Alfredo']

menu['Pot Sticker'] = 11.25 

menu['Meat Fingers'] = 8

menu['Pizza'] = 30

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

The interaction for this code:
14.5
There are 4 items on the menu.
{'Chicken Alfredo': 14.5, 'Pot Sticker': 11.25, 'Pizza': 30, 'Meat Fingers': 8}

No comments:

Post a Comment