18.11.2014 Views

Zelle - Chapter 11.pdf - CTools

Zelle - Chapter 11.pdf - CTools

Zelle - Chapter 11.pdf - CTools

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Dictionaries<br />

• Lists label their entries<br />

based on the position in the<br />

list<br />

• Dictionaries are like bags -<br />

no order<br />

• So we mark the things we<br />

put in the dictionary with a<br />

“tag”<br />

>>> purse = dict()<br />

>>> purse['money'] = 12<br />

>>> purse['candy'] = 3<br />

>>> purse['tissues'] = 75<br />

>>> print purse<br />

{'money': 12, 'tissues': 75, 'candy': 3}<br />

>>> print purse['candy']<br />

3<br />

>>> purse['candy'] = purse['candy'] + 2<br />

>>> print purse<br />

{'money': 12, 'tissues': 75, 'candy': 5}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!