question=''' Choose: 1. Add name to committee. 2. Delete name from committee. 3. Is name in committee? 0. Quit Choice: ''' def MakeCommittee(): comm=[] while True: choice=raw_input(question) print if choice in '123': name=raw_input('name of person: ') print name=name.strip() # remove any leading and trailing spaces if name=='': print 'Error: no name to process' else: if choice=='1': if name in comm: print '%s is already on the committee' % (name) else: comm.append(name) print '%s added.' % (name) elif choice=='2': if name in comm: comm.remove(name) print '%s removed.' % (name) else: print 'Error: %s is not on the committee' % (name) else: if name in comm: print 'Yes, %s is on the committee' % (name) else: print 'No, %s is not on the committee' % (name) elif choice=='0': break else: print 'Error: %s is not a valid choice.' % (choice) print 'Done' return comm print MakeCommittee()