Table of Contents
In this section of python programming, we will print the words of even length in the given phrase.
input_string = "Welcome to GoCoding" print("Input string is: "+input_string + "\n") def even_len(i): # String split i = i.split(' ') for strng in i: # Check length is even if len(strng)%2 == 0: print(strng) even_len(input_string)
To achieve our task we have first split the phrase into words using split() and calculated the length of words using len(). If the length is found to be even the word is printed on the screen using print function.