Environment Diagrams: Difficult
writing out environment diagrams
For each function, write out the environment diagram.
def f(x):
def g(y):
def h(z):
print('jade')
h(1)
return x + y
g(2 * x)
f(4)
def flip(digits):
def slice(num):
num, last = num // 10, num % 10
return num, last
flipped = 0
while digits > 10:
digits, last = slice(digits)
flipped = flipped * 10 + last
return flipped
flip(123456)