MediumProgramming
What are function parameters with default values called?
TL;DR
Optional parameters — option 4.
Question
Function parameters with default values are called:
Answer choices
- Special.
- Named.
- Positional.
- Optional.
- Ordinary.
Explanation
When a parameter has a default value, its corresponding argument can be omitted:
def greet(name='Guest'):
return f'Hello, {name}!'
print(greet())
Calling the function without an argument uses 'Guest'. Such parameters are therefore called optional in this exercise. Passing an argument by name is a separate characteristic and does not itself imply a default value.
Platforms
- Stepik
