Interview Question

Data Engineering Manager Interview



write a python program to count words?

AnswerAdd Tags

Interview Answers

2 Answers


sentence = "I am an engineer" sentenceList = sentence.split(sep=" ") print(len(sentenceList))

willthiswork on


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.