Python ProgrammingPython Programming

How to compare two string with some characters only in Python?

str1 = "Can"
str2 = "Canada"
print(str1 in str2)
print(str1.startswith(str2))
print(str2.startswith(str1))

print(str1.endswith(str2))

str3 = "CAN"
print(str3 in str2)
Output
True
False
True
False
False