compare last three characters
write a program to check if the last three characters in the given two strings are same.
input
the first and second lines of inputs are the same.
output
the output should be either True or False
Explanation
given strings are apple , pimple. in both strings,the last three characters ple are common.
sample input 1
apple
pimple
sample output 1
True
sample input 2
meals
deal
sample output 2
False
str1 = input("Input string 1: ")
str2 = input("Input string 2: ")
if str1[-3:len(str1)] == str2[-3:len(str2)]:
print("True")
else:
print("False")
Comments
Leave a comment