-1

I am not too sure why this returns None, it worked perfectly before I tried putting it into a function. It is supposed to return a list of words that are between 6 and 9 characters long.

def level_list(minn, maxx):
    for words in word_list:
        if len(words) >= minn and len(words) <= maxx:
            return level_words.append(words)

print(level_list(6, 9))
vaultah
  • 44,105
  • 12
  • 114
  • 143
dhcrain
  • 11
  • 5

1 Answers1

0

list.append is a mutator method, meaning that unlike string methods which return the modified version of the string, this directly changes the list and returns None.


More about:

List mutability

Mutator methods

More mutator methods

Community
  • 1
  • 1
Ecko
  • 1,030
  • 9
  • 30