Skip to content

Instantly share code, notes, and snippets.

@myano
Created January 16, 2015 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myano/b235763c23e1287abe17 to your computer and use it in GitHub Desktop.
Save myano/b235763c23e1287abe17 to your computer and use it in GitHub Desktop.
#!/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