Need help playing scrabble


#1



Stuck on this problem. I have it played out in my head but don't know how to go about doing it. Any help will be much appreciated

https://www.codecademy.com/courses/python-intermediate-en-rCQKw/1/3?curriculum_id=4f89dab3d788890003000096#


Replace this line with your code. 
def scrabble_score(word):
    total = 0
    for t in range(len(word)):


#2

Think it through. Given a word, we need to identify each letter and then use the lookup table, scores to determine the score, then add that score to a running total. When the loop is finished, return the total. You have a good start.


#3

Identify each letter in scores right ?


#4

Correct. So how would we go about using the lookup table?


#5

I'll give you a tip to help keep this simple. Since we are not manipulating any data, we do not need to use a range() when iterating over the word. We can use a lookup loop...

for letter in word:

#6

Ok cool thanks for the tip. Now I just need to identify each letter in score, add the given word and return the total

def scrabble_score(word):
    word = word.lower()
    total = 0
    for letter in word:
        total += score[letter]
    return total

I got it correct. Thanks for the help.


#7

This topic was automatically closed after 24 hours. New replies are no longer allowed.