In this lesson
- It starts with a question. A function is defined as rate(distance, litres). Someone calls rate(20, 100). What has probably gone wrong?
- The idea you will find. Position decides meaning. — The names in the definition are labels for the slots, and the call fills them left to right. Swapping two values of the same kind produces no error at all — just a wrong answer, which is why naming the arguments at the call site is worth the extra typing.
- Length. 5 short steps. Progress saves on this phone.
Part of Python: Functions That Return
Writing functions that give you something back — and knowing what happens if they do not.