def Function in Python
def is the keyword that creates a named function. Shape: def total(a, b): return a + b. Colon, indented body. Optional docstring on the first line inside. Functions are objects — you can pass them to sorted(key=...) or store them. Without return, the caller gets None.
def vs lambda: def has a clear name and can have many lines. lambda is one expression. Freshers should live in def until the key= case appears.
def Function in Python — output — Hi Asha. def builds greet; the call runs it.
def square(n):
return n * n
│ square(5)
▼
25def vs lambda: named reusable vs tiny expression.