Python Program To Print Even String In Python

In this article, we will learn how to we can print only the even length words in a string using Python language.

To achieve our objective, we first convert the string into a list. The list contains all the words present in the string as separate elements. This is done using the string.split() function.

We then loop through the newly created list and find the length of each word. If the length of a word is divisible by 2 then it is even and we can print that word.


  1. Initialize a string variable je_string

  2. Split the string using the split() function and store the result into je_splitted

  3. Apply a for each loop to je_splitted using the loop variable je_ele

  4. if len(je_ele) is divisible by two then print the result

# Initialise a String
je_string = "I love JavaExercise"
# Split the string
je_splitted = je_string.split(" ")
# apply for each loop
for je_ele in je_splitted:
    #check the divisiblity of length of each element by 2
    if len(je_ele) % 2 == 0: