MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / getWordPattern

Function getWordPattern

other/word_patterns.py:4–15  ·  view source on GitHub ↗
(word)

Source from the content-addressed store, hash-verified

2import pprint, time
3
4def getWordPattern(word):
5 word = word.upper()
6 nextNum = 0
7 letterNums = {}
8 wordPattern = []
9
10 for letter in word:
11 if letter not in letterNums:
12 letterNums[letter] = str(nextNum)
13 nextNum += 1
14 wordPattern.append(letterNums[letter])
15 return '.'.join(wordPattern)
16
17def main():
18 startTime = time.time()

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected