wk.3.1.1
Provide the type and value of the expressions being evaluated, Assume the following definitions have been made
def a(x, y, z):
if x:
return y
else:
return z
def b(y,z):
return a(y>z, y, z)
- >>> a(False, 2, 3)
- >>> b(3,2)
- >>> a(3>2, a, b)
- >>> b(a,b)
(Contrary to expectation, in Python, it is technically legal to compare functions. We actually were expecting this to generate an error, but it doesn't.)
Page Source