Open alexanderGGreenberg opened 6 years ago
Implement the funciton in src/wordValue.py with the following specification:
src/wordValue.py
given a dict of letter to numeric value mappings, calculate the value of the given word example valueDict = {'o': 3, 's': 7} word = 'os' return 3+7 = 10
🙋🏻
valueDict = {'o':3, 's':7} word = [] for key in valueDict.keys(): word.append(key) result = [] for letter in word: result.append(valueDict[letter]) total = sum(result) ???
valueDict = {'o':3, 's':7}
word = []
for key in valueDict.keys(): word.append(key)
result = []
for letter in word:
result.append(valueDict[letter])
total = sum(result)
I got this!!
Implement the funciton in
src/wordValue.py
with the following specification: