Question: Please provide the python code for the Problem one: Word Scores given below. by following the instructions- Getting Started There are a few different files
Please provide the python code for the Problem one: Word Scores given below. by following the instructions-
Getting Started
There are a few different files that accompany this assignment. To complete the first game, youll work with a skeleton file, a testing file, and a word list (covering problems one through five). The file problem_6.py is a skeleton file. Some unit testing has been created for you in the file testing_problem_6.py. The second game is accomplished by completing the programming in the skeleton file named problem_6_part_2.py. Youll also use the word list for this program. While programming, all files must be saved to the same folder. When you submit your work, dont submit the word list.
Run the Code
Open the file problem_6.py. Do not modify this file yet. Look through the code. This code loads the words for word.txt and calls the start_game function. More tasks are necessary to make this a game, but this code should run right now. If working correctly, you will see the output shown in Figure 2. If it does not work, ensure all the files are in the same folder. If it still doesnt work, ensure that you completed the steps in the first problem set under the heading Establish the Working Directory.
Unit Testing
This assignment requires you to design several modular functions, then glue them together to create the game. Instead of waiting until the entire game is ready, inspect what you expect from each line of code. Test each function as you write them before coding other functions. Unit testing is important whenever you code. There are three tests written for you to get you started. As you progress through this assignment, run testing_problem_6.py. If your code works as expected, this file will return a message indicating your success. Should your code be insufficient or cause an error, a message indicating your lack of success will be provided. The three pre-written unit test functions are test_scoring_words, test_hand_updates, and test_word_validity. These script files will test the functions calc_word_score, hand_update, and word_is_valid, respectively.
Figure 2 Console Output from Running problem_6.py Skeleton Before Any Changes
Loading word list from file...
83667 words loaded
start_game not implemented
playing_hands not implemented
Problem One: Word Scores
This game requires scores to be calculated from the words played. You need to design a solution to this problem using the function calc_word_score. This function should accept a string of lowercase letters as input (a word) and the maximum hand size. It will return a score. How a word arrives at this function or how this function fits in the big picture is outside the scope of this objective.
There are several considerations. Some are safe to assume, while other things are unsafe to assume. Lastly, there are specific considerations when calculating the score. It is safe to assume that the word passed to this function is always a lowercase string (although it could be an empty string). Letter values are static; they are defined in the dictionary points_by_letter. Its not safe to assume that there are always seven letters in a hand. (Thats why its passed as a variable.) As a bonus, if the word length is equivalent to the maximum hand size, the player gets an extra 50 points.
When you have finished solving this problem, use the test file to test your function. Additionally, make sure that you develop tests for this function that satisfy boundaries that are not assessed with the test file you were given. When you have completed testing this function, ensure any testing written in the problem_6.py file is commented out before submitting your work. If you document your test code elsewhere, ensure that it is included in your submission (even if its a separate file). Make sure that your comments clarify the purpose of this type of content.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
