Quarry School

Functions

Subject: ComputingLevel 1 · estimated

Give a block of lines a name, pass it values and get a result back. Trace what each name holds inside and outside the function, and predict each result before you run the program.

Lessons

Quick review

Read the whole unit on one page

  1. Give a repeated task a nameSubject: ComputingLevel 1 · Foundations
  2. Pass an argumentSubject: ComputingLevel 1 · Foundations
  3. Return a resultSubject: ComputingLevel 1 · Foundations
  4. Trace a local nameSubject: ComputingLevel 1 · Foundations
  5. Compose two small functionsSubject: ComputingLevel 1 · Foundations

Sources

  1. Python 3.13 Tutorial, 4.8 Defining Functions. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Give a repeated task a name, Return a result, Trace a local name, Compose two small functions.
  2. Python 3.13 Language Reference, 8.7 Function definitions. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Give a repeated task a name.
  3. Python 3.13 Language Reference, 6.3.4 Calls. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Give a repeated task a name, Pass an argument, Return a result, Compose two small functions.
  4. Python 3.13 Library Reference, Built-in Exceptions: NameError. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Give a repeated task a name.
  5. Python 3.13 Tutorial, 4.10 Intermezzo: Coding Style. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Give a repeated task a name.
  6. Python 3.13 Language Reference, 7.1 Expression statements. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Give a repeated task a name, Return a result.
  7. Python 3.13 Glossary: parameter. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Pass an argument.
  8. Python 3.13 Glossary: argument. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Pass an argument.
  9. Python 3.13 Tutorial, 3.1.2 Text. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Pass an argument.
  10. Python 3.13 Language Reference, 7.6 The return statement. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Return a result, Compose two small functions.
  11. Python 3.13 Language Reference, 8.1 The if statement. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Return a result, Compose two small functions.
  12. Python 3.13 Library Reference, Built-in Exceptions: TypeError. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Return a result, Compose two small functions.
  13. Python 3.13 Language Reference, 4.2 Naming and binding. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Trace a local name.
  14. Python 3.13 Language Reference, 6.10.1 Value comparisons. Python Software Foundation. Python Software Foundation License Version 2. Read 1 Dec 2026. Cited in Compose two small functions.