Answer to Question #238379 in Python for Siva

Question #238379
Compare last three characters
Explanation given strings are apple,pimple in both the strings the last three characters ple are comman
1
Expert's answer
2021-09-17T03:23:04-0400




def equal_last(str1, str2):
    str1 = list(str1)
    str2 = list(str2)
    str1.reverse()
    str2.reverse()
    last_three1 = str1[0:3]
    last_three2 = str2[0:3]
    if last_three2 == last_three1:
        print("True\n")
    else:
        print("False\n")














print("Sample Input 1")
print("apple")
print("pimple")
print("Sample Output 1")
equal_last("apple","pimple")


print("\n\nSample Input 2")
print("meals")
print("deal")
print("Sample Output 2")
equal_last("meals","deal")







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