Nov-19-2019, 06:59 PM
'spam, spam'.split()
gives you ['spam', ' spam']
. That extra space in the second one makes them not duplicates. You need to strip each word. This can be done with a list comprehension: Fi = [word.split() for word in Fish.split()]
Note that line 15 does nothing. First of all, there will be no newline in the text, since raw_input only accepts one line of input. Second of all, you store the result in Fi, but then overwrite that on line 16. Fish doesn't change when you split it, and you couldn't really split Fi, because it's a list at that point, not a string.
You don't need OrderedDict. You sort the result after making a list of it, so you lose any order stored in OrderedDict. So you can just use set to remove the duplicates.
Finally, you are using version 2.7. You need to upgrade to the latest version. End of life for 2.7 is in 42 days.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures