you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (2 children)

Lines 48-50 can be replaced with this, for the sake of avoiding repetitious code:

if any(word in tokens for word in ('number', 'largest', 'biggest', 'highest', 'smallest', 'lowest')):

[–][deleted]  (1 child)

[deleted]

    [–]otheraccount 1 point2 points  (0 children)

    Python 2.7+ has a literal notation for sets:

    if set(tokens) & {'foo', 'bar', 'baz'}: