#!/usr/bin/env python3 import sys words = [ "about", "after", "again", "below", "could", "every", "first", "found", "great", "house", "large", "learn", "never", "other", "place", "plant", "point", "right", "small", "sound", "spell", "still", "study", "their", "there", "these", "thing", "think", "three", "water", "where", "which", "world", "would", "write", ] index = 0 poss = words for arg in sys.argv[1:]: idcs = [] if len(arg) == 0 or arg == "-": index += 1 continue for i in range(len(poss)): if poss[i][index] in arg: idcs.append(i) poss = [poss[i] for i in idcs] index += 1 print(poss)