Change
def isValid(word):
to def isValid(word, wordtype):
, adapt the call to this function to put the two variables and it should solve the error.