Python Functions Quiz
- Questions: 15
- Easy
- Pass mark: 70%
A function gives a piece of code a name, so you can run it whenever you need it: work out the fuel for an engine burn, check whether a launch can go ahead, or turn a mass into a weight on Mars. This free quiz has 15 short questions on defining and calling functions in Python, on passing arguments and getting values back, and on the mistakes beginners make most often with them.
What the quiz covers
- Defining and calling functions, and why
print()is notreturn - Positional and keyword arguments, default values and
*args - What
returndoes, including leaving a function early - Local and outside variables, and lists passed into a function
- Docstrings, calling one function inside another and passing a function as a value
How it works
- 15 questions: 11 with one correct answer, 4 where you select every correct answer
- After each question you see the correct answer and a short explanation
- No time limit and no account needed
- Score 70% or more (11 of 15) to pass
Each topic has a runnable example: creating simple functions, functions with parameters, return statement basics and variable arguments with *args. After this one, try the Python Sets Quiz or the Python Basics Quiz.