PI. List Methods

Run Settings
LanguagePython
Language Version
Run Command
seed = [ "A hedgehog is any of the spiny mammals of the subfamily Erinaceinae, which\ is in the order Erinaceomorpha", "here are seventeen species of hedgehog in five genera, found through parts\ of Europe, Asia, Africa and New Zealand (by introduction)", "There are no hedgehogs native to Australia, and no living species native\ to the Americas", "Hedgehogs share distant ancestry with shrews (family Soricidae), with\ gymnures possibly being the intermediate link, and have changed little over\ the last 15 million years", "Like many of the first mammals, they have adapted to a nocturnal way of life", "Hedgehogs' spiny protection resembles that of the unrelated rodent\ porcupines and monotreme echidnas" ] # Thanks Wiki for content words = [] # Now lets split sentences to the words and find non-uniqe words for sentence in seed: words.extend(sentence.split(' ')) non_unique = [] met_words = [] for word in words: if word not in met_words: met_words.append(word) elif word not in non_unique: non_unique.append(word) non_unique.sort() print "Non-unique words are:", ', '.join(non_unique) + '.'
Editor Settings
Theme
Key bindings
Full width
Lines