CMU 15-112 Fall 2015 Quiz 3 Practice: Code Tracing
(Due never)



# Code Tracing #1 of 2 def onesDigit(n): return n%10 def ct1(L): for i in range(len(L)): L[i] += sum(L) + max(L) return sorted(L, key=onesDigit) a = [2,1,0] print(ct1(a)) print(a)

# Code Tracing #2 of 2 def ct2(a, b): a += [3] a = a + [4] for c in a: for i in range(len(b)): if (b[i] not in a): print("A", end="") b[i] += c elif (c % 2 == 1): print("B", end="") b += [c] elif (b[-1] != c): print("C", end="") b = b + [c] return (a,b) a = [4] b = [2,3] print(ct2(a,b)) print(a,b)