diff options
author | Puneeth Chaganti | 2010-10-26 20:54:21 +0530 |
---|---|---|
committer | Puneeth Chaganti | 2010-10-26 20:54:21 +0530 |
commit | 8d92700e2cff705b775093e7d3d668b5e713a4e9 (patch) | |
tree | 328b2a51eef96d62e67d02570c83bdf70b21efb1 /dictionaries | |
parent | 09bc218715a412690c4881dd3f3e8a2f4958d69e (diff) | |
download | st-scripts-8d92700e2cff705b775093e7d3d668b5e713a4e9.tar.gz st-scripts-8d92700e2cff705b775093e7d3d668b5e713a4e9.tar.bz2 st-scripts-8d92700e2cff705b775093e7d3d668b5e713a4e9.zip |
Reviewed dictionaries script.
Diffstat (limited to 'dictionaries')
-rw-r--r-- | dictionaries/script.rst | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/dictionaries/script.rst b/dictionaries/script.rst index 1f5d102..c3539f6 100644 --- a/dictionaries/script.rst +++ b/dictionaries/script.rst @@ -6,9 +6,9 @@ .. 1. Create dictionaries .. #. Add data to dictionaries .. #. Retrieve data -.. #. Familiarize using ``.keys()`` and ``.values()`` methods -.. #. Checking for container-ship of keys -.. #. Iterating over elements +.. #. use ``.keys()`` and ``.values()`` methods +.. #. Check for container-ship of keys +.. #. Iterate over elements .. Prerequisites .. ------------- @@ -22,6 +22,7 @@ External Reviewer : Checklist OK? : <put date stamp here, if OK> [2010-10-05] +.. #[Puneeth: Quickref] ============ Dictionaries @@ -49,6 +50,8 @@ indexes, dictionaries have keys or strings as indexes. Before we can proceed, start your IPython interpreter with the ``-pylab`` option. +.. #[Puneeth: We don't need pylab] + {{{ start ipython interpreter by issuing command ipython -pylab }}} {{{ switch to next slide, Creating dictionary }}} @@ -59,11 +62,11 @@ your IPython interpreter. mt_dict = {} -Notice that unlike lists curly braces are used define ``dictionary``, +Notice that unlike lists, curly braces are used define ``dictionary``. {{{ move the mouse over curly braces to grab attention }}} -Now let us see how to create a filled dictionary, +Now let us see how to create a non-empty dictionary, :: extensions = {'jpg' : 'JPEG Image', 'py' : 'Python script', 'html' : 'Html document', 'pdf' : 'Portable Document Format'} @@ -146,10 +149,9 @@ dictionary. For that we can use ``in``, 'py' in extensions 'odt' in extensions -So in short it will return ``True`` if the key is found in the -dictionary, and will return ``False`` if key is not present. Note that -we can check only for container-ship of keys in dictionaries and not -values. +It will return ``True`` if the key is found in the dictionary, and +will return ``False`` if key is not present. Note that we can check +only for container-ship of keys in dictionaries and not values. {{{ switch to next slide, Retrieve keys and values }}} |