Python ('," etc.) symbol i dont write in for line [closed]
Text=""" the to and below try """
Text = Text.lower()
word_list = Text.split()
d = {}
for word in word_list:
d[word] = d.get(word, 0) + 1
word_freq = []
for key, value in d.items():
word_freq.append((value, key))
for x in range(0,3):
dex = word_freq[x]
if (dex != 'the' and dex !='and'):
print(word_freq[x])
I want to print the words in the above text, but if "the" IS "to," I want him to skip it and print the next word. In my "Apple" condition in the last line, I tried to say that " the " and " to " should not be printed, but I did not succeed. What I want to do is actually ignore it as 'the', but I don't know how to introduce the symbol'' to the program as char.
Beacuse my word is not the, actually 'the'
from Recent Questions - Stack Overflow https://ift.tt/3wALvGv
https://ift.tt/eA8V8J
Comments
Post a Comment