Here is the question:
I have a file with these words:
hey how are you I am fine and you Yes I am fine
And it is asked to find the numbe
I found this solution very simply and readable:
with open("filename", 'r') as file: text = file.read().strip().split() len_chars = sum(len(word) for word in text) print(len_chars)