Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What will be the output of student('John', 21) if the function is defined as def student(name, age)?
Think about how the order of parameters matches with arguments.
If def student(name, age) is defined, what arguments can you pass in when calling it?
Remember to match the types as well.
What is a positional argument?
Remember, it's all about where it goes.
True or False: The first argument passed to a function always matches the second parameter.
Think carefully about the order!
Create a function that accepts three positional arguments: first_name, last_name, and age. Call this function with varying combinations of parameters to demonstrate its flexibility.
Think about how you can mix and match.
Write a Python function that takes two parameters but sets a default value for the second. Call it with only the first argument, then both arguments.
What happens when you pass only the first argument?
6 more questions in this section. Enroll free to practise them all.
Enroll free