← Python Programming learning pathPython Programming · Module 8 of 10
Functions
Functions package reusable steps with def, parameters and return values.
📖 Key ideas
- def name(params): defines a function.
- Parameters receive values; return sends a result back.
- A function without return gives None.
- Default parameters: def greet(name="Guest").
- Variables inside a function are local to it.
💡 Real-life example: A function is a juice machine: put fruit in (arguments), get juice out (return value), use it as many times as you like.
defKeyword to define a function
returnSends a value back
ParameterName that receives an input value
NoneValue returned when nothing is returned