Hi , can anyone explain me this test task, because I'm not understanding it very well. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

29th Sep 2021, 7:32 PM
Alan Restrepo
Alan Restrepo - avatar
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))
29th Sep 2021, 7:41 PM
A͢J
A͢J - avatar
+ 2
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ thank you so much, it work. thanks for the help
29th Sep 2021, 8:25 PM
Alan Restrepo
Alan Restrepo - avatar
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)
29th Sep 2021, 8:24 PM
Brian
Brian - avatar
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
29th Sep 2021, 8:38 PM
Alan Restrepo
Alan Restrepo - avatar
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.
29th Sep 2021, 9:00 PM
Brian
Brian - avatar