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

1 Answer

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

print_odd_words(s)



 
'''
run:

c
c++
php
 
'''

 



answered Jan 21, 2020 by avibootz
...