We have to count number of words which is ending with ‘Y’ or ‘y’.
Example:- This website name is easy coding zone .
in this string only one word which is ended with ‘y’. So number of word is 1.
mystring=input(“Enter a string”)
for i in mylist:
if(i[-1]==‘y’ or i[-1]==‘Y’):
print(“Number of words ending with y is=”,no_words)
Enter a string
This website name is easy coding zone
Number of words ending with y is= 1