MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / numMatchingLetters

Function numMatchingLetters

src/gamesbyexample/hacking.py:108–114  ·  view source on GitHub ↗

Returns the number of matching letters in these two words.

(word1, word2)

Source from the content-addressed store, hash-verified

106
107
108def numMatchingLetters(word1, word2):
109 """Returns the number of matching letters in these two words."""
110 matches = 0
111 for i in range(len(word1)):
112 if word1[i] == word2[i]:
113 matches += 1
114 return matches
115
116
117def getComputerMemoryString(words):

Callers 2

mainFunction · 0.85
getWordsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected