You are currently viewing How to find words which are even or odd from a sentence in Python?

How to find words which are even or odd from a sentence in Python?

This is another article in the series of Python Practice Programs. In this article, we will write a program to get if the length of a word in a sentence is even or odd.

sentence = "In computer languages , pyhon is very easy to learn but it takes time"
c = sentence.split(' ')

for word in c:
   
    if len(word) %2==0:
        print('even: ', word)

Leave a Reply