My code is able to show each word that starts with a specific letter from a text file, but I want it to not show duplicate words. Here is my code:
with open('text.txt','r') as myFile:
data=myFile.read().lower()
for s in data.split():
if s.startswith("r"):
print(s)
Like I said, my code does print the words but it shows duplicates. Thank you for helping