Below is a statement to be executed in the shell. Write Python statements to go before it that will guarantee that the statement will run without error. It doesn't matter what the code does, just that it runs. Below is an example. Code: a = p(b % c)
Statements to go before this one to guarantee that it will run without error:
def p(n):
return n + 1
b = 45
c = 13
Code:
n = d[x](96) + 7
Statements to go before this one to guarantee that it will run without error:
def hello(n):
return n + 5
d = {1:hello}
x = 1
I don't get the code. How can there be a square bracket, [x], with a parenthesis, (96), together to get a value in the dictionary d? What does that mean? Also, how come "hello" does not have quotes around the word since it is a string? I just don't get the code overall.
hellois a function not a string. 1 is the key in the dictionary which has a value of thefunctionhello. Dictionary values can be anything and keys don't have to be strings.