curriculum/challenges/english/blocks/daily-coding-challenges-python/68f6587287ad1f4ad39b0c85.md
Given two strings representing fingerprints, determine if they are a match using the following rules:
a-z).is_match("helloworld", "helloworld") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_match("helloworld", "helloworld"), True)`)
}})
is_match("helloworld", "helloworlds") should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_match("helloworld", "helloworlds"), False)`)
}})
is_match("helloworld", "jelloworld") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_match("helloworld", "jelloworld"), True)`)
}})
is_match("thequickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthelazydog") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_match("thequickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthelazydog"), True)`)
}})
is_match("theslickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthehazydog") should return True.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_match("theslickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthehazydog"), True)`)
}})
is_match("thequickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthehazycat") should return False.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertIs(is_match("thequickbrownfoxjumpsoverthelazydog", "thequickbrownfoxjumpsoverthehazycat"), False)`)
}})
def is_match(fingerprint_a, fingerprint_b):
return fingerprint_a
def is_match(fingerprint_a, fingerprint_b):
if len(fingerprint_a) != len(fingerprint_b):
return False
mismatches = 0
for c1, c2 in zip(fingerprint_a, fingerprint_b):
if c1 != c2:
mismatches += 1
if mismatches > len(fingerprint_a) // 10:
return False
return True