Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python For this assignment, you will to write a Scrabble cheater from scratch. Write a Python script that asks the user for their Scrabble rack

"python" For this assignment, you will to write a Scrabble cheater from scratch. Write a Python script that asks the user for their Scrabble rack and prints all valid Scrabble words that can be constructed from that rack, along with their Scrabble scores, sorted by score. An example input and output: Enter the letters in your Scrabble rack: ZAEFIEE 17 feeze 17 feaze 16 faze 15 fiz 15 fez 12 zee 6 fie 6 fee 5 if 5 fa 5 ef 2 ai 2 ae Download the CROSSWD.TXT file which contains all words in the official SOWPODS word list, one word per line. You will also need to a dictionary containing all letters and their Scrabble values: scores = {"a": 1, "c": 3, "b": 3, "e": 1, "d": 2, "g": 2, "f": 4, "i": 1, "h": 4, "k": 5, "j": 8, "m": 3, "l": 1, "o": 1, "n": 1, "q": 10, "p": 3, "s": 1, "r": 1, "u": 1, "t": 1, "w": 4, "v": 4, "y": 4, "x": 8, "z": 10} Write the code to get the Scrabble rack (the letters available to make words). A rack should contain 7 letters. Handle the case where a a user forgets to supply enough letters for their rack; in this case, print an error message saying they need to supply some more letters. Make sure you are consistent about capitalization. Next, write the code to find all words from the word list that are made of letters that are a subset of the rack letters. There are many ways to do this, but here's one way that is easy to reason about and is fast enough for our purposes: go through every word in a valid_words list you would have made from the CROSSWD.TXT file. Make sure you handle repeat letters: once a letter from the rack has been used, it can't be used again. Finally, write the code to determine the Scrabble scores for each valid word, using the scores dictionary from above.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions