+ 1
How to find the number of words in an input?
16 Antworten
+ 2
In Python3.
Like Abhay wrote.
example = input("")
splited = example.split(" ")
lenofexample = len(splited)
+ 2
Yup but in python also it's the same ,using split method and then applying len function,😁
+ 1
yochanan sheinberger he didn't mentioned the language tho method is same I guess ,split it and take the length!
+ 1
If you mean Javascript then... use this:-
<input type="text" id="myText"> <button id="myBtn">Submit text<button>
<script>
//hope this helps buddy!
var content = document.getElementById("myText").value;
document.getElementById("myBtn").onClick = function() {
alert(content.length);
}
</script>
+ 1
a="hello world".split()
print(len(a))
+ 1
+ 1
0
var input = document.getElementById("myInput").value;
var inputArray = Input.split();
consol.log(inputArray.length + 1);
0
Mention the language in tags where you written input
0
In which language?
0
Abhay I assumed he meant java script. I was definitely wrong... ):
0
Its easy to find the number words (split method)..
Find the number of letters (dont take it seriously... .take it as a funny project and do this )
.
Note : this is for Aman sir .....
0
A=input()
A.split()
len(A.split())
0
oke oyediran 2 ppl already answered ,I dunno why ppl keep posting same thing when it has been answered or did you added some extra info in your comment that I am missing ? If it is so sorry!!
0
Count for the number of blank space