Write a function that reads the words in words.txt and stores them as keys in a dictionary. It doesn’t matter what the values are. Then you can use the in operator as a fast way to check whether a string is in the dictionary.

Write a function that reads the words in words.txt and stores them as keys in a dictionary. It doesn’t matter what the values are. Then you can use the in operator as a fast way to check whether a string is in the dictionary.



'''
f1=open('words.txt')
d1=dict()
i=0
for line in f1:
    words=line.split()
    for i in range(len(words)):
        d1[words[i]]=i
print d1
print 'abc' in d1


Learn More :