Search the courses, subjects, tracks, games and features, or jump straight to a page.
4 cards from this section. Quick, good the night before a test.
Define a simple function that prints a greeting.
Think about how to define a function with the def keyword.
What do we call a block of code that performs a specific task?
It's the main topic of today's session.
What is the purpose of a function in Python?
Think about what we use functions for in programming.
True or False: A function can return multiple values.
Consider how data can be collected in a single structure.
Write a function that accepts two arguments, multiplies them, and returns the result. Include default values for each argument.
Remember to set default values and how multiplication works in Python.
Create a function that accepts both *args and **kwargs, returning a dictionary combining both. Include an example call.
Think about how to handle variable-length arguments in function definitions.
5 more questions in this section. Enroll free to practise them all.
Enroll free