9/15 - scrabble

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

Hello, I feel really dumb but no matter what i can’t figure out why this code doesn’t work. Somebody be so kind and explain it to me please.


May we assume that the score dictionary is in place?


Yeah, the ‘score’ dictionary is given in the excerscise. It’s the whole alphabet.


Can you please link to the exercise so we can test your code and see if the error is replicatable.



^^ Hopefully linking like this works


As expected, the code works. Is the SCT not accepting the submitted code?


In the lower bottom of the screen it was giving me the error “with your code pie = 3 when it should be 5” or something like that (already got the code from the program for the excercise and skipped it).


That’s odd. It returns 5 in my test. Did you do anything to modify the dictionary, perhaps?


No, definitely not. Though i went back now, reset the excercise and input my code and it worked. Well, no idea what happend before (I’m 99% positive i haven’t modified the dictionary in any way and input the code exactly as it’s here). But hey, thanks for the help nonetheless and sorry to waste your time!


No problem. Always a pleasure.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.