I am trying to get this python code to get rid of punctuation marks associated with words and count the unique words. For some reason it's still counting both "hello." and "hello". Any help would be most appreciated.
def word_distribution(words):
word_dict = {}
words = words.lower()
words = words.split()
for word in words:
if ord('a') <= ord(word[-1]) <= ord('z'):
pass
elif ord('A') <= ord(word[-1]) <= ord('Z'):
pass
else:
word[:-1]
word_dict = {word:words.count(word)+1 for word in set(words)}
return(word_dict)