A dictionary is a set of key-value pairs, for example:. As you can see, keys and values can be strings or integers. What’s more, values can also be dictionaries or variable references. Here is the formal definition of terms that will be used soon:. After assigning a slot to a slot , the left-hand slot will be holding a reference to the right-hand. For example, After executing the following commands, b[1][0] is 1, rather than 0:. Slots must be assigned before it is read or subscripted, and integers and strings cannot be subscripted. Consider the following comammd list:. will output 1, not 3. In this command, it is guaranteed that is storing a dictionary, not a string or an integer.Then d is infinite, since d[0][0][0][0][0][0]... is always d. In this command, it is guaranteed that is storing a dictionary, not a string or an integer.
A dictionary is a set of key-value pairs, for example:
{'color':'red', 'price':2, 7:'test', 100:-100}
As you can see, keys and values can be strings or integers. What’s more, values can also be dictionaries or variable references. Here is the formal definition of terms that will be used soon:
key ::= INTEGER | STRING
value ::= INTEGER | STRING | dict
pair ::= key ':' value
dict ::= '{' [pair (',' pair)*] '}'
var ::= 'a'|'b'|'c'|...|'z'
slot ::= var('[' key ']')*
lvar ::= slot
rvar ::= slot | value
Here ('[' key ']')* means zero or more subscripts, [pair (',' pair)*] means zero or more key-value pairs.
Strings are always enclosed by single quotes ('') and consists of up to 10 lower-case letters. Integers always have absolute values of no more than 1000. You can insert spaces anywhere, except inside strings or integers. For example, { 'a':-1} and {'a' : -1 } are the same, but {'a b':1} and {'a':- 1} are both illegal.
Your task is to execute a series of commands and print the results. There are 3 kinds of commands:
1. Assignment: