New Entries - what are the sequences?


#1


https://www.codecademy.com/en/courses/python-beginner-en-pwmb1/2/2?curriculum_id=4f89dab3d788890003000096


no error occurred

however, i'd like to know what are the sequences of adding these items??
it does not seem like following alpha or time?


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['Stinky Tofu'] = 5.5
menu['French Fried'] = 9.0
menu['Pasta'] = 12


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

it turns out as below

14.5
There are 4 items on the menu.
{'Pasta': 12, 'Chicken Alfredo': 14.5, 'French Fried': 9.0, 'Stinky Tofu': 5.5}


#2

dictionaries are unordered, you access by key (not by index), so why would you need order?

having said this, in python3.6 dictionaries are ordered


#3

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