How to print the even length words from a string in Python

1 Answer

0 votes
def print_even_words(s): 
    s = s.split(' ')  
      
    for word in s:  
        if len(word) % 2 == 0: 
            print(word)  
  
  
s = "python c c++ c# php java"

print_even_words(s)



 
'''
run:
 
python
c#
java
 
'''

 



answered Jan 21, 2020 by avibootz
...