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



# Code Tracing #1 of 2 import string def keyFn(val): return (ord(val) - ord('a'))%5 def ct1(st): (result, i) = ("", 1) for c in sorted(set(st) - set(st.upper()), key=keyFn): (result, i) = (result + i*c, i+1) return (result, set(result)) print(ct1("bCDfCBe"))

# Code Tracing #2 of 2 def ct2(): (result, d) = (list(), dict()) for x in range(1,20,3): d[x%4] = x for key in sorted(d.keys()): result.append((key, d[key])) return result print(ct2())