You are using input()
instead of raw_input()
; this interprets the input as a Python expression. It is easy to make that throw a SyntaxError exception:
>>> input("Enter a sentence: ")
Enter a sentence: The Quick Brown Fox
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1
The Quick Brown Fox
^
SyntaxError: invalid syntax
Use raw_input()
throughout instead:
dic[raw_input("Enter the value you want to store: ")] = raw_input("Enter the access key of a value: ")
You probably want to turn these two questions around:
dic[raw_input("Enter the access key of a value: ")] = raw_input("Enter the value you want to store: ")
Python will ask for the value first. If you need to ask for the key first, store it in a separate variable first:
key = raw_input("Enter the access key of a value: ")
dic[key] = raw_input("Enter the value you want to store: ")