How to count the number of words in a string with Python

1 Answer

0 votes
s = "python java php c++ c#"

total = len(s.split()) 
  
print(total)
  
  
  
'''
run:
  
5
  
'''

 



answered Jan 22, 2020 by avibootz
...