I'm trying write a function that reads the words contained in the .txt file and writes them as keys in the dictionary. The value can be any. The program should allow me to use the in operator to check if the string is in the dictionary.
I tried something like this:
words = open('words.txt')
def k():
for word in words:
key = word[0]
print(k)
I have no idea how to do it. anyone could help me?