On Dec 29, 8:07 pm, Scott David Daniels <[email protected]> wrote: > Ross wrote: > > ... Use get to write histogram more concisely. You should be able to > > eliminate the if statement. > > > def histogram(s): > > d = dict() > > for c in s: > > d[c]= d.get(c,0) > > return d > > > This code returns a dictionary of all the letters to any string s I > > give it but each corresponding value is incorrectly the default of 0. > > What am I doing wrong? > > How is this code supposed to count? > > --Scott David Daniels > [email protected]
I realize the code isn't counting, but how am I to do this without using an if statement as the problem instructs? -- http://mail.python.org/mailman/listinfo/python-list
