Skip to content

Instantly share code, notes, and snippets.

View Behemoth79's full-sized avatar

Salvador Luque Behemoth79

  • Madrid
View GitHub Profile
@textbook
textbook / ProblemSet4.py
Created October 23, 2012 22:08
MIT 6.00x - PSet 4 answers by jonrsharpe
# 1. Word Scores
def getWordScore(word, n):
return (len(word) * sum(SCRABBLE_LETTER_VALUES[x] for x in word)) + (50 if len(word) == n else 0)
# Test implementation
def getFrequencyDict(aStr):
return dict((letter, aStr.count(letter)) for letter in aStr)
# 2. Dealing with hands
def updateHand(hand, word):