Created
August 31, 2018 13:05
-
-
Save lavie/c55539277bd991a6c0bf2a61b7585a02 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
base=wordlist[0] #consider the first word in the list | |
for word in wordlist: #loop through the entire list checking if | |
if not word.startswith(base): # the word we're considering starts with the base | |
print base #If not... we have a new base, print the current | |
base=word # one and move to this new one | |
#else word starts with base | |
#don't output word, and go on to the next item in the list | |
print base |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment