#sample solution
def scrabble_score(word):
word = word.lower()
#print "word in lowercase: " + word
sum = 0
for c in word:
for key in score:
if c == key:
#print score[c]
sum = sum + int(score[c])
return sum
def scrabble_score(word):
word = word.lower()
#print "word in lowercase: " + word
sum = 0
for c in word:
for key in score:
if c == key:
#print score[c]
sum = sum + int(score[c])
return sum
Hi, I am not sure why my code is not working:
ReplyDeletedef scrabble_score(word):
#key=score.key
total =0
#value= score.values
value=[]
new_value=[]
word=word.lower()
for i in word:
new=score[i],
value.append(new)
#value.append(word[i])
#return value
for num in value:
if num != " ":
total +=num
return total
pass
print total
Hi, I am not sure why my code is not working:
ReplyDeletedef scrabble_score(word):
#key=score.key
total =0
#value= score.values
value=[]
new_value=[]
word=word.lower()
for i in word:
new=score[i],
value.append(new)
#value.append(word[i])
#return value
for num in value:
if num != " ":
total +=num
return total
pass
print total