0
Hi , can anyone explain me this test task, because I'm not understanding it very well.
The test task is this: By giving the text as input, the number of words it contains is obtained. Input example Hello World Output example 2 The split () method can be used to divide the string into words. The thing is that in the example said that "Hello world" has two words, but is not true obviously, in other example "hi how are you", It says that has four word's. I think I'm missing something , maybe is a miss understanding of my part.
5 Answers
+ 2
anthony silver
Take user input and apply split method to split input into list then using len method get the length of list which will be output
For example:
lis = inp.split(' ') # here inp is input
print (len(lis))
+ 2
A͢J - SÍoÍlÍoÍHÍeÍlÍpÍeÍrÍ thank you so much, it work. thanks for the help
0
đ¤ anthony silver has your vision been checked lately? How many fingers am I holding upâ? How many words are in "Hello World"? Hint: â(two)
0
Wow, Brian i didn't know that, you get the award for the obvious. I didn't know how to do the test task and the other guy understand that I tried to say and he help me, if you don't have anything to contribute for helping someone don't do say nothing
0
anthony silver Sorry, I honestly don't understand why you say it is "not true obviously" to claim "Hello World" counts as two words. Maybe it was meant as sarcasm. Regardless, I hope you'll accept my apology that I misinterpret it.