def get_fragment(s):
partition = set("KR")
frag_1, frag_2 = "", ""
for idx in range(len(s)-1):
# meet K or meet P, and next character is not P
if s[idx] in partition and s[idx+1] != "P":
frag_1, frag_2 = s[:idx+1], s[idx+1:]
# meet K or meet P on last position
if s[-1] in partition:
frag_1, frag_2 = s, ""
if not frag_1 and not frag_2:
# no digestion site
print("There is no digestion site.")
else:
# have digestion site
print("Fragment 1:", frag_1)
print("Fragment 2:", frag_2)
return
# -------------------------------------------------
get_fragment("MTEYKLVVVGAG")
print()
get_fragment("MTEYKPLVVVGAG")
print()
get_fragment("MTEYLVVRVGAG")
print()
get_fragment("MTEYLVVRPVGAG")
print()