What does the following code print?
= 1
a = 2
b = 3
c
= (a, a, c)
v
print(v, sep=" ")
What does the following code print?
= 1
a = 2
b = 3
c
= (a, a, c)
a, b, c
print(a, b, c, sep=" ")
Suppose the following code is executed. The numbers at left are line numbers and are not part of the code itself. If any line causes an error, assume that line is not run and continue execution with the next line.
1 a, b, c = 6, 4, 2
2 (z, x) = c, b
3 print((x, z))
4 v = (x, z, c)
5 print(v)
6 a, b = v
Consider the following function:
def f(a, b):
= a
xa, ya = b
xb, yb return (ya, xa), (yb, xb)
For each of the following calls to the above function, say what the function returns, or “error” if an error will occur.
f(1, 2)
f(1, 2, 3, 4)
f((1, 2), (3, 4))
f(((1, 1), 2), (3, 4))
f((1, 1, 2), (3, 4))