Shakespeare: Difference between revisions

imported>Zanwenhuahao
imported>Zanwenhuahao
Line 112:
>>> lstFinal
['apple', 'pear', 'oranges', 'kiwi', 'banana', 'monkey']
</pre>
 
====Dictionaries====
* Dictionaries are another data structure commonly used in programming. Dictionaries (think of dictionary in real life) stores what we call <b> key-value pairs</b>. One common thing to do with dictionary is determine an entry's value given its key.
* Entries in the dictionary are stored <b> orderless </b> (i.e. no way to arrange storage position according to value)
* <b>keys</b> for each entry in the dictionary must be unique, <b> values </b> do not have to be unique.
* For our simplicity, we will use a string as keys. For more information on dictionary: https://docs.python.org/2/tutorial/datastructures.html#dictionaries
<pre>
 
</pre>
Anonymous user