CS 1301 Recitation 12 11_10

CS 1301 Recitation 12 11_10 - >>> >>>...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
>>> myDict = {"one":1, "two":2} >>> print myDict {'two': 2, 'one': 1} >>> myDict["three"] = 3 >>> print myDict {'three': 3, 'two': 2, 'one': 1} >>> len(myDict) 3 >>> myDict.items() [('three', 3), ('two', 2), ('one', 1)] >>> myDict.keys() ['three', 'two', 'one'] >>> ========================= RESTART ==============================
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: >>> >>> myDict = countChar("This is just a test") >>> print myDict {'a': 1, ' ': 4, 'e': 1, 'i': 2, 'h': 1, 'j': 1, 's': 4, 'u': 1, 'T': 1, 't': 3} >>> myDict["t"] 3 >>> myDict["x"] Traceback (most recent call last): File "<pyshell#10>", line 1 myDict["x"] KeyError: 'x' >>>...
View Full Document

This note was uploaded on 02/16/2012 for the course CS 1301 taught by Professor Staff during the Fall '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online