This is an assessment based on Jeremiah Lant's Concept map for Python dictionaries.

  1. Suppose a dictionary fruit was created as follows:
    <br /> fruit = {}<br /> fruit['pear'] = 2<br /> fruit['banana'] = 6<br /> fruit['ananas'] = 1<br />
    You iterate over the keys in this dictionary with a loop:
    for fruit in fruit
    What do you get?</p>
    1. pear, banana, ananas (the order the keys been set)
    2. ananas, banana, pear (alphabetical order)
    3. ananas, pear, banana (the order of the values)
    4. The order is implementation dependent and you do not know
  2. You are given two lists a and b, one of which (a) you want to use as keys and the other (b) as the values of a dictionary d, always pairing up a key from a with a value from b. Implement at least two different ways of constructing d.