Created
June 19, 2015 01:42
-
-
Save myano/88628d11bf7b72a5b775 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
#!/usr/bin/env python2 | |
''' | |
Copyright 2015 Michael Yanovich, yanovich.net | |
Licensed under the Eiffel Forum License 2. | |
''' | |
def prepare_list(inc): | |
inc_list = inc.split() | |
out_list = list() | |
for x in inc_list: | |
temp = x | |
if x.startswith('@') or x.startswith('+'): | |
temp = x[1:] | |
out_list.append(temp) | |
return out_list | |
def main(): | |
num_of_channels = int(raw_input('Please enter # of channels: ')) | |
channel_nick_list = list() | |
for x in range(1, num_of_channels + 1): | |
temp = prepare_list(raw_input('Channel #%s: ' % (x))) | |
channel_nick_list.append(temp) | |
channel_nick_sets = list() | |
for x in channel_nick_list: | |
temp = set(x) | |
channel_nick_sets.append(temp) | |
overlap = set.intersection(*channel_nick_sets) | |
diff = set.union(*channel_nick_sets) - set.intersection(*channel_nick_sets) | |
print '\n\n' | |
print 'Overlap:', overlap | |
print '\n' | |
print 'Diff:', diff | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment