← Back to challenges

Is One String in the Other?

PythonHardconditionslogicstringsvalidation

Instructions

Create a function that takes two strings and returns True if either of the strings appears at the very end of the other string. Return False otherwise. The character * is a wildcard, so it can take the place of any character.

Examples

overlap("ABC", "Ican'tsingmyABC") ➞ True

overlap("abc", "Ican'tsingmyABC") ➞ True

overlap("Ican'tsingmyABC", "abc") ➞ True

overlap("hello world", "hello") ➞ False

overlap("+=", "this should work too +=") ➞ True

overlap("hey", "*********") ➞ True

Notes

Your function should NOT be case sensitive (see example #2).

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.