J'ai besoin d'aide pour une fonction qui ne peut pas décider comment inclure une plage de nombres. Ceci est ma fonction et je ne sais pas pourquoi ne fonctionne pas correctement avec les nombres dans une gamme.problème avec une gamme de nombres python
def word_score(word):
""" (str) -> int
Return the point value the word earns.
Word length: < 3: 0 points
3-6: 1 point per character for all characters in word
7-9: 2 points per character for all characters in word
10+: 3 points per character for all characters in word
>>> word_score('DRUDGERY')
16
"""
if len(word) < 3:
return 0
elif len(word) == range(3, 6) :
return len(word)
elif len(word) == range(7, 9):
return len(word)* 2
elif len(word) >= 10:
return len(word) * 3
return word_score