Lesson 1.2Code~50 min
Functions: little machines
Inputs in, output out. Write functions, make them decide, and compose them.
Module 1 · 0/8 done
Little machines
A function is a machine with a rule inside. You drop an input in, it applies the rule, and an output comes out. Same input, same output, every time.
input3
the machinex => 2 * x + 1
output7
Mathematicians write this as : “the function called f, given x, gives back 2 times x plus 1”. It’s exactly the same idea in code — and it’s the single most important idea in this course, because a machine-learning model is just a function whose rule was learned instead of written.