promptdojo_

Write one_step(w, x, y, lr) that runs one full training step for the model pred = w * x and returns the updated w, rounded to 2 decimals:

  1. forward: pred = w * x
  2. gradient: 2 * (pred - y) * x
  3. update: w - lr * grad

full-screen editor opens — close anytime to keep reading.