Guided pathThis is part of Understand Transformers & BERTBack to the path

Calling a function — a tool with an input and an output

P41.using-functions.01 · Audience: guest, language-pro, it-ml · Prerequisites: Dictionaries — a mini table

Real LLM grading for this pageLLM grading (this page):

You have already been reaching for tools without naming them: len(words) counted a list, sorted(words) put it in order. Each is a function — a tool you hand a value and it hands one back. Before this module names them, picture a kitchen gadget: you feed it something, you get something out. This module gives that everyday shape its Python name and puts three built-in tools in your hands.

Step 1 / 3What name(...) means
ⓘ Concept: A function is a tool with an input and an output
When you write len(words) you are calling a function. len is the tool's name; the value in the brackets — words — is the input you hand it (its argument); and the value it hands back is the output (its return value). Read it as a sentence: "give len this list, take back its length."

Why it matters — Almost everything a notebook does is call a function. Once you can read one call, you can read most code — it is the same shape every time.

Ask the mentor about this module

Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.

Ctrl/Cmd + Enter to send

🎓 Practice ladder

1 graded rung · ~5 min

Your turn: take a short word list, count it with len, order it with sorted, and total a list of numbers with sum — each a tool with an input and an output. Press Run.

Explorer rung — call three built-in functions

Loading exercise…

Where next?