Module 4 · after
The same 6 questions you saw before the module. No running the code: predict, then compare with your first score.
def f(x): return (x - 2) * (x - 2) + 1 best = min([(f(x), x) for x in range(-3, 6)]) print(best)
import math p = 0.5 * 0.5 * 0.5 print(round(-math.log(p), 2), round(3 * -math.log(0.5), 2))
def dot(a, b): total = 0 for x, y in zip(a, b): total += x * y return total def linear(x, w): return [dot(wo, x) for wo in w] print(linear([2, -1], [[1, 1], [0, 3], [-2, 0]]))
counts = {'a': 2, 'b': 1, 'c': 1} total = sum(counts.values()) chances = {} for k in counts: chances[k] = counts[k] / total print(chances['a'], sum(chances.values()))
Your answers are saved with a random id, not your name, so we can see which lessons work. Privacy