ling571notes1102 - float(freq_d1[k...

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

View Full Document Right Arrow Icon
.keys=words .items=words and value counts for w1 in a.keys(): print w1,a[w1]-b.get(w1,0) or, make third dictionary by storing to memory so that you can format the way in which it is printed on screen. This third dictionary will have the difference values for each word, not combined values for both dicts. c = {} for w1 in a.keys(): c[w1] = a[w1]-b.get(w1,0)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: float((freq_d1[k]) - float(freq_d5[k]))/float((freq_d1[k]) + float(freq_d5[k])) 2 parameters to a function: def add(x,y) return x+y add(4,5) 9-----a = {} a['a']=[1,2] def add(x): return x[0] + x[1] add(a.get('a')) 3-----how to read 2 files into one program for line in open('2001.txt','r'): ... for line in open('2005.txt','r'): ......
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online