Created
January 16, 2015 22:54
-
-
Save myano/b235763c23e1287abe17 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 python | |
''' | |
Copyright 2015 Michael Yanovich, yanovich.net | |
Licensed under the Eiffel Forum License 2. | |
''' | |
from sets import Set | |
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) | |
print '\n\n' | |
print overlap | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment