Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose: To calculate a score of a Scrabble word using recursion Degree of Difficulty: Easy In the game of Scrabble. players take turns placing lettered

image text in transcribed

Purpose: To calculate a score of a Scrabble word using recursion Degree of Difficulty: Easy In the game of Scrabble. players take turns placing lettered tiles onto a board to form words. The goal is to score more points than the other players. Every letter has a corresponding point value attached to it. You score points by adding all of these point values together when you place lettered tiles on the board to form a word. For this question, we are going to write a recursive function to determine the points for a given word. Program Design Write a recursirve function to calculate points in Scrabble. It should take one string parameter and return an integer representing the number of points scored for the letters in string. The value of each letter is determined by a dictionary (provided in a starter file below) which has each letter as the key and that letter's point value as the value An example of using the function can be seen below, with a proper function call and output: valuescore ("gif") print (value) value-score ("zoo" print (value) 12 We have provided a starter file a7q3-starter.py which includes a dictionary with the values for each letter! It is also below for reference: points {"a'' : 1 , "b" :3 , " " :3 , "d":2,"e'" : 1 , "f":4,"g" :2,"h" :4 , " i " : 1 , "j":8,"k":5, - Making this solution recursive can be tricky, so here are some hints to help you: Remember the base case will be when the input string is blank, or the length of O. A string can be indexed to get a specific character Slicing will be very important for this

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

Recommended Textbook for

More Books

Students also viewed these Databases questions