loop
Functions

Module 4 · Functions · Lesson 3 of 4

Where functions come from

You've already been calling functions — print(), len(), input(). So where do functions actually come from? There are three sources, and the lovely part is that you call all of them the same way: a name, then parentheses.

Three sources, one way to call
built into Python
print() len() input()
from a module
math.sqrt() random.randint()
written by you
def greet(): ...
📞
call it!
Run it yourselfruns in your browser · Python
main.py

Built-in, imported, or your own — once a function exists, calling it looks identical. That consistency is what makes Python feel so approachable. Time to write one yourself.