Jan-20-2021, 09:55 PM
(This post was last modified: Jan-28-2021, 08:10 PM by BashBedlam.)
It's the line :
dict_words = dict.fromkeys(list1, [])That's causing the trouble. I'm not sure how you would use the method fromkeys differently in order to correct the problem but if you replace that line with :
dict_words = {'!,': [], 'Hey!': []}then your code will produce the expected results.