2014-05-05 Dictionary Introduction

posted May 5, 2014, 6:27 AM by Samuel Konstantinovich   [ updated May 8, 2015, 5:49 AM ]
Do Now:
Look up python documentation on dictionaries.
a. How are they displayed?
b. What are the pairs of numbers called?
c. How do you add values?
d. How do you get values?


Assignment: (complete for homework)

A.Take your madlibs text and print out the number of times each word appears.
text ="fish is a a A a A fish.\n is a a a fish"
tally(text) would print:
is  2
a 8
fish 3
B. Make sure you don't treat different case letters differently. Improve your tally so that 'The' and 'the' are counted as the same word.