Write a program to count the no. of occurrence of word in
given string
Ex- Ram is good boy. Ram is doing good job.
Ram – 2
is – 2
good – 2
boy – 1
doing –1
job – 1
Answer / Ashish Maurya
Here is a simple Python solution:nn```ndef count_words(string):n words = string.split()n counts = {} n for word in words:n if word in counts:n counts[word] += 1n else:n counts[word] = 1n return countsn```nFor your example, the function would output: {"Ram":2,"is":2,"good":2,"boy":1,"doing":1,"job":1}
| Is This Answer Correct ? | 0 Yes | 0 No |
why do you want to join tcs
what is recursion in c language?
if a customer's blackberry stopped syncing their calendar wirelessly what would you do?if a customber deleted mail from his blackberry but it did delete from his mailbox how would ypu resolve this
find the next number:60 24 7 4
If navara d40 injektor damage.what is the problem when we drive??
i want to do oracle certification..could any one pleas tell me what is the level 1 certification exam in oracle? how do we get dumps?
What experience do you have in RMA?s (returned material authorizations?)
Why the secondary ip address of interface is not advertising in IGP cloud?
2. A product selected for testing is equally likely to have been produced by one the 6 machines/processes. (i) Determine sample space ‘S’ (ii) What is the probability that the product is from machine 1? (iii) What is the probability that the product is from machine 2 or machine 4? (iv) What is the probability that the product is from both machine 5 and machine 3? (v) What is the probability that the product is not from machine 6? (vi) What is the probability that the product is not from either machine 6 or machine 1?
URGENT.. I want to make a really good project using ADVANCE JAVA Can anyone suggest any great n innovative ideas I have nearly 4 months to make it so it can be big n time consuming... It should be Web Based also... It can use more than one Java Technologies.. Please suggest me something innovative n great.. thanks:
i am diploma 3rd year student tell me sbout mpsc exam or any other
How Good is tata nano?
Civil Engineering (5086)
Mechanical Engineering (4453)
Electrical Engineering (16638)
Electronics Communications (3918)
Chemical Engineering (1095)
Aeronautical Engineering (239)
Bio Engineering (96)
Metallurgy (361)
Industrial Engineering (259)
Instrumentation (3014)
Automobile Engineering (332)
Mechatronics Engineering (97)
Marine Engineering (124)
Power Plant Engineering (172)
Textile Engineering (575)
Production Engineering (25)
Satellite Systems Engineering (106)
Engineering AllOther (1379)