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)
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