Answer to Question #318366 in Python for compare last three

Question #318366

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


1
Expert's answer
2022-03-26T02:39:05-0400
str1 = input("Input string 1: ")
str2 = input("Input string 2: ")
if str1[-3:len(str1)] == str2[-3:len(str2)]:
    print("True")
else:
    print("False")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS