Created
September 28, 2016 12:42
-
-
Save poliarush/2dbee405c14b6a5faca0cc67ff935910 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
from collections import OrderedDict | |
msg = """If web server returns any error message | |
for any query by application server | |
then application server should catch and display | |
these error messages appropriately to the users""" | |
items = OrderedDict([(_, Counter(_)) for _ in msg.split()]) | |
cleared = zip(*filter(lambda (k, v): len(v.values()) == sum(v.values()), items.iteritems()))[0] | |
print cleared | |
print cleared[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
('If', 'web', 'any', 'for', 'query', 'by', 'then', 'should', 'and', 'display', 'to', 'the') | |
If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment