Write a function checkvertical(board, word, row, col), whichreturns True if the word word can be added to the board starting atposition board[row][col] and going down. The restrictions are (1)it has to fit entirely on the board, (2) it has to intersect andmatch with one or more non-blank letters on the board, and (3) itcannot change any letters on the board, other than blanks (that is,overlapping mismatches are not allowed).
My program isn’t working 🙁 Can anyone fix the program?
My program:
def checkvertical(board, word, row, col):
if len(word) > 20 – row:
return False
matchesoneletter = False
for k in range(len(word)):
wordletter = word[k]
boardletter = board[row + k][col]
if wordletter == boardletter:
matchesoneletter = True
if boardletter == blank:
continue
elif boardletter != wordletter:
return False
return matchesoneletter
Expert Answer
Answer to Write a function checkvertical(board, word, row, col), which returns True if the word word can be added to the board sta…