How can I produce a list of Scrabble word values for a list of words, and a function scrabbleValue that is passed a the string parameter word and...
View the step-by-step solution to:


How can I produce a list of Scrabble word values for a list of words, and a

function scrabbleValue that is passed a the string parameter word and returns the scrabble value for that word. The scrabble value of each letter is in the dictionary letter_values. I can use the map function and the scrabbleValue function to and print a list of scrabble word values for the words in the list words.

def scrabbleValue(word):

  return None # replace this with your code

letter_values = {'a':1, 'b':3, 'c':3, 'd':2, 'e':1, 'f':4, 'g': 2, 'h':4,

  'i':1, 'j':8, 'k':5, 'l':1, 'm':3, 'n':1, 'o':1, 'p':3, 'q':10, 'r':1,

  's':1, 't':1, 'u':1, 'v':8, 'w':4, 'x':8, 'y':4, 'z':10}

words = ['python', 'program', 'list', 'string', 'unix', 'hours', 'syntax', 'error']

Top Answer

The code is given below... View the full answer


def scrabbleValue(word) :
word=word . lower ( )
for alpha in word:
if alpha in letter_values:
val+=letter_values [alpha]
return val
words = ['python', "program', 'list",...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question