Python: scrabble_score
This commit is contained in:
parent
0dd5b31529
commit
c3f4773fd7
4 changed files with 144 additions and 0 deletions
12
python/scrabble-score/scrabble_score.py
Normal file
12
python/scrabble-score/scrabble_score.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
SCORES = {'A': 1, 'E': 1, 'I': 1, 'O': 1, 'U': 1, 'L': 1, 'N': 1, 'R': 1,
|
||||
'S': 1, 'T': 1,
|
||||
'D': 2, 'G': 2,
|
||||
'B': 3, 'C': 3, 'M': 3, 'P': 3,
|
||||
'F': 4, 'H': 4, 'V': 4, 'W': 4, 'Y': 4,
|
||||
'K': 5,
|
||||
'J': 8, 'X': 8,
|
||||
'Q': 10, 'Z': 10}
|
||||
|
||||
|
||||
def score(word):
|
||||
return sum(SCORES[ch.upper()] for ch in word)
|
||||
Loading…
Add table
Add a link
Reference in a new issue