On 20/03/13 15:09, Mitya Sirenef wrote:
<cut>
By the way, you can further simplify it by doing:
def histogram2(s):
return {c: d.get(c,0)+1 for c in s}
That will work in python 3, in python 2 you need:
return dict((c: d.get(c,0)+1) for c in s)
Thanks again Mitya, although I'm not sure it's a simplification at my
present level.
--
Regards,
Phil
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor