Python functions for beginners
Practice built-in functions, define your own functions, and use parameters and return values.
Understanding functions
A function packages a useful operation behind a name. Calling a function executes it; defining one prepares it for later. Work through built-in tools, random numbers, parameters, and the difference between printing a value and returning it to the caller.
def double(number):
return number * 2
result = double(6)
print(result) # 12The parameter number receives 6. The return statement sends 12 back to the calling code, where it can be saved or used again.
What you will practice
Work through eight coding missions, then test your understanding with ten multiple-choice questions. Each mission provides starter code, a hint, and feedback after you run it.
- Toolbox warm-up — Built-in functions; Type conversion functions
- Random-number lab — Random numbers; Exercise 1
- Repair the order — Definitions and uses; Exercises 2 and 3
- Print twice — Parameters and arguments; Fruitful functions and void functions
- Return a sum — Fruitful functions and void functions; addtwo example
- Compose the math calls — Math functions; composition example
- Overtime checkpoint — Exercise 6
- Grade gate — Exercise 7
Your chapter progress is saved in this browser. Complete all 18 checks to unlock a certificate at your earned practice score, and download your notebook or grade report to keep a copy.
Read, practice, and try again
For the chapter reading, see Python for Everybody: Functions by Charles R. Severance (CC BY 4.0). ZHUDDLE adds its own practice activities and scoring. The browser runs Python after its first interpreter download; no local installation is required.
Start the functions exercises →