Question #315171

compare last three characters


write a program to check if the three last characters in the given two 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 strings, the last three characters ple are commom


so the output should be true.


sample input 1

apple

pimple


sample output 1

true


sample input 2

meals

deal


sample output 2

faslse


Expert's answer

def comp3char(s1, s2):
    return s1[-3:] == s2[-3:]


def main():
    s1 = input()
    s2 = input()

    if comp3char(s1, s2):
        print('true')
    else:
        print('false')

main()

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!

LATEST TUTORIALS
APPROVED BY CLIENTS