Interview Question
Data Engineering Manager Interview
-
Metawrite a python program to count words?
AnswerAdd Tags
Interview Answers
2 Answers
▲
1
▼
sentence = "I am an engineer" sentenceList = sentence.split(sep=" ") print(len(sentenceList))
willthiswork on
▲
0
▼
txt = "I am an engineer" #converts the txt variable to a LIST and then does a LEN to get the number of words x = len(txt.split()) print(x)
Anonymous on
Add Answers or Comments
To comment on this, Sign In or Sign Up.