← All questions
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

  1. Special.
  2. Named.
  3. Positional.
  4. Optional.
  5. 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.

Default argumentsFunctionsPython

Platforms

  • Stepik

Download now and try it for free on your own tasks!

Download for Windows
10 15 free credits • No credit card requiredVersion: Loading…

No installation - download and run. No registration - sign in with Google.