Ich brauche Hilfe mit einer Funktion, die nicht entscheiden kann, wie eine Reihe von Zahlen enthalten. Das ist meine Funktion und ich weiß nicht, warum nicht richtig mit den Zahlen in einem Bereich funktioniert.Problem mit einer Reihe von Zahlen 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