Not sure why words are becoming gibberish? Python 3 list of words not counting/splitting for frequency

Here's something else for you to deal with:

>>> text = ["Suppose your text looks like this,",
...         "a perfectly normal list of strings.",
...         "What could go wrong?"]

>>> print(normalize(text))

suppose your text looks like thisa perfectly normal list of stringswhat could go wrong                                                                       

It might be the case that your input data will never look like that, but for example if you got the input text with readlines() or something.read().split("\n"), then you split it into a list of strings based on "\n" (the newline) as the separator, and you need to add it back in when re-joining them to a single large list.

/r/learnprogramming Thread