On Thu, Oct 5, 2017 at 11:11 AM, Irv Kalb <i...@furrypants.com> wrote:
>     # If we have not seen this employee name before, add it to the dictionary
>     # like key value pair:     '<Employee Name>': [0, 0]
>     if not(name in employeeDataDict):
>         salesCountDict[name] = [0, 0]

Python provides a "not in" operator, which is far superior to
parenthesizing the expression. But, even better, you can use a
defaultdict to create this automatically - and you could even, with a
slight tweak, make use of collections.Counter to do all the work for
you.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to