X-Git-Url: https://projects.mako.cc/source/wordplay-cdsw-solutions/blobdiff_plain/884ad8e21ea1ea9d1dd411b2a503d0dff4294c59..HEAD:/solution_2_advanced.py diff --git a/solution_2_advanced.py b/solution_2_advanced.py index dc157a3..8867838 100644 --- a/solution_2_advanced.py +++ b/solution_2_advanced.py @@ -1,13 +1,13 @@ import scrabble - # What is the longest word that starts with a q? -# This problem was ill-specified. What if there isn't a single longest word? What if -# there is a tie? -# We designed this problem with that ambiguity in mind, because sometimes the thing -# we want to measure may not exist, or may not exist in the way we anticipate. +# This problem was somewhat ill-specified. What if there isn't a +# single longest word? What if there is a tie? +# We designed this problem with that ambiguity in mind, because +# sometimes the thing we want to measure may not exist, or may not +# exist in the way we anticipate. # This solution keeps EVERY word of the longest length. @@ -15,17 +15,12 @@ longest_so_far = [] length_of_longest_word = 0 for word in scrabble.wordlist: - if word[0] == 'q': - if len(word) > length_of_longest_word: - length_of_longest_word = len(word) - longest_so_far = [word] - elif len(word) == length_of_longest_word: - longest_so_far.append(word) + if len(word) > length_of_longest_word: + length_of_longest_word = len(word) + longest_so_far = [word] + elif len(word) == length_of_longest_word: + longest_so_far.append(word) #print longest_so_far # Use this to see the progression. - -print longest_so_far - - - +print(longest_so_far)