(Nov-26-2020, 11:16 PM)shirleylam852 Wrote: So far my code should be correct.
As I have very little knowledge what you want to accomplish I can't say for certain that your statement is incorrect. However, it is safe to say that either split() on line # 16 is redundant or your code does something which you didn't intend.
How your function cleanedup() performs: it eliminates all characters (including non-printing i.e. whitespaces, newlines, CR etc) which are not in alphabet. So result is this:
>>> cleanedup('Monty Python Flying Circus\n') montypythonflyingcircus # returns one word string >>> cleanedup('Monty Python Flying Circus\n').split() ['montypythonflyingcircus'] # nothing to split on, so one item list >>> for item in cleanedup('Monty Python Flying Circus\n').split(): ... print(item) ... montypythonflyingcircusDespite the fact that I don't know what your objective is I doubt that this can be called 'correct'. To be more assistive you need to provide more information.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.