Z : Returns a match if the specified characters are at the end of the string
Example-
re.search('StartZ',"string Start") will match the pattern.
program-
#import the re module
import re
#take input of string
print("Enter string")
s=input()
#check string is ends with 'end'
x=re.search('endZ',s)
if x:
print("String is ends with 'end'")
else:
print("String is not ends with 'end'")
#check string is ends with 'Finish'
x=re.search('FinishZ',s)
if x:
print("String is ends with 'Finish'")
else:
print("String is not ends with 'Finish'")
Enter string
This is end
String is ends with 'end'
String is not ends with 'Finish'
Enter string
string is Finish
String is not ends with 'end'
String is ends with 'Finish'