Last answered:

02 Apr 2020

Posted on:

01 Apr 2020

1

Strings in python

How to count the number of words in a string? suppose I want to .upper() whole string if user input of the string contains 3 words. Or .lower if it contains only one word?
1 answers ( 0 marked as helpful)
Instructor
Posted on:

02 Apr 2020

0
Hi Subhadeep,  This is an excellent question and there are different approaches you could try.  I suggest you take a look here: https://www.geeksforgeeks.org/python-program-to-count-words-in-a-sentence/ Or you could test your own approach and let us know what you've come up with.    Best,  Eli

Submit an answer