CSC108H1 Study Guide - Final Guide: Bubble Sort, Toronto Waterfront Marathon, Sorting Algorithm

93 views20 pages
yifanyang and 39659 others unlocked
CSC108H1 Full Course Notes
21
CSC108H1 Full Course Notes
Verified Note
21 documents

Document Summary

There may be more boxes than you need; leave unused boxes blank. for i in range(2): for j in range(2): print("({0}, {1})". format(i, j)) (0, 0) (0, 1) (1, 0) (1, 1) There may be more boxes than you need; leave unused boxes blank. Consider this python code that has been saved in the le words. py: Write what this code prints when words. py is run, with one line per box. Consider this python code: def f1(x, y): print("f1:", x, y) return x + y def f2(x, y): print("f2:", x, y) return x * y print(f1(f2(6, 5), f1(2, 4))) Consider this python function: def f(x): if x % 2 != 0: if x ** 2 <= 36: return "pow" else: return x // 3 else: Call f(2) if x < 0 and abs(x) > 5: f(13) return false elif not x + 2 > 8: return x / 2 return "zonk" f(-8) f(10)