I need help trying to put an inputted string into a dictionary
Input:
Hello my name is Bob Hello Hello
Actual output:
Desired output:
{'Hello' : '1', 'my' : '2', 'name' : '3', 'is' : '4', 'Bob' : '5'}
Should only record the same word once
My code so far:
s = input("input sentence: ")
file = open("Original.txt", 'w')
file.write(s)
file.write("\n")
file.close()
num = int(1,2,3,4,5)
dictionary = dict(num(s.split()))
file = open("Dictionary.txt", 'a')
file.write(dictionary)
file.close()
f = open("Dictionary.txt", 'r')
print(file.read)
print(s)