Question #227201

Compare Last Three Characters

Write a program to check if the last three characters in the two given strings are the same.

Input

The first and second lines of inputs are strings.

Output

The output should be either True or False.

Explanation

Given strings are

apple, pimple. In both the strings, the last three characters ple are common. So the output should be

True.

Sample Input 1

apple

pimple

Sample Output 1

True

Sample Input 2

meals

deal

Sample Output 2

False




1
Expert's answer
2021-08-18T17:52:31-0400
first = input("Enter first word: ")
second = input("Enter second word: ")
if first[len(first) - 1] == second[len(second) - 1and first[len(first) - 2] == second[len(second) - 2and first[len(first) - 3] == second[len(second) - 3]:
    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!
LATEST TUTORIALS
APPROVED BY CLIENTS