X-Git-Url: https://projects.mako.cc/source/wordplay-cdsw-solutions/blobdiff_plain/715cf79efb1139d981e5716ed14f471fbeaddb2a..7b538ea99568eb4511b2b92e3f55193796017866:/solution_6_advanced.py diff --git a/solution_6_advanced.py b/solution_6_advanced.py index 5db3920..36aa0d2 100644 --- a/solution_6_advanced.py +++ b/solution_6_advanced.py @@ -1,13 +1,17 @@ import scrabble -# Print the longest word where every character is unique. -# I used a Set for this. Don't worry: you didn't miss anything if you don't know -# what a set is. We didn't teach it, but if you are reading this, you get a bonus! +# Print the longest word where every character is unique. I used a +# Set for this which we'll talk about today. -# A set is a container like a list or a dict, except that *each element can be stored only once*. -# Think of it like the keys of a dict, except there isn't any value associated with each key. -# I use Sets to count digits below. Feel free to look up the Set online and try it in the -# interpreter. +# Don't worry: you didn't miss anything if you don't know what a set +# is. We didn't teach it, but if you are reading this, you get a +# bonus! + +# A set is a container like a list or a dict, except that *each +# element can be stored only once*. Think of it like the keys of a +# dict, except there isn't any value associated with each key. I use +# Sets to count digits below. Feel free to look up the Set online and +# try it in the interpreter. new_words = [] for word in scrabble.wordlist: @@ -28,4 +32,4 @@ for word in new_words: elif len(word) == length_of_longest_word: longest_so_far.append(word) -print longest_so_far +print(longest_so_far)