MCPcopy Create free account
hub / github.com/geekcomputers/Python / CheckTwoStrings

Function CheckTwoStrings

recursiveStrings.py:8–17  ·  view source on GitHub ↗
(str1, str2)

Source from the content-addressed store, hash-verified

6
7
8def CheckTwoStrings(str1, str2):
9 # function takes two strings and check if they are similar
10 # returns True if they are identical and False if they are different
11
12 if len(str1) != len(str2):
13 return False
14 if len(str1) == 1 and len(str2) == 1:
15 return str1[0] == str2[0]
16
17 return (str1[0] == str2[0]) and CheckTwoStrings(str1[1:], str2[1:])
18
19
20def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected