Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
**kwargs | Arguments in Function
course content

Conteúdo do Curso

Intermediate Python: Arguments, Scopes and Decorators

**kwargs**kwargs

Now, let's move on to keyword arbitrary arguments or **kwargs. The principle of how **kwargs works is the same as for *args, but it accepts keyword arguments instead of positional ones. **kwargs packs information into a dictionary, so we will work with it accordingly.

The correct order for the arguments is as follows:

  1. Positional
  2. Optional
  3. *args
  4. **kwargs

If you want to unpack dictionaries, you need to use ** before the dictionary variable.

1. What does **kwargs in a Python function signature represent?
2. What will print_details(name="Alice", age=30) output?
3. Given the function definition below, which call is valid?

What does **kwargs in a Python function signature represent?

Selecione a resposta correta

What will print_details(name="Alice", age=30) output?

Selecione a resposta correta

Given the function definition below, which call is valid?

Selecione a resposta correta

Tudo estava claro?

Seção 2. Capítulo 4
course content

Conteúdo do Curso

Intermediate Python: Arguments, Scopes and Decorators

**kwargs**kwargs

Now, let's move on to keyword arbitrary arguments or **kwargs. The principle of how **kwargs works is the same as for *args, but it accepts keyword arguments instead of positional ones. **kwargs packs information into a dictionary, so we will work with it accordingly.

The correct order for the arguments is as follows:

  1. Positional
  2. Optional
  3. *args
  4. **kwargs

If you want to unpack dictionaries, you need to use ** before the dictionary variable.

1. What does **kwargs in a Python function signature represent?
2. What will print_details(name="Alice", age=30) output?
3. Given the function definition below, which call is valid?

What does **kwargs in a Python function signature represent?

Selecione a resposta correta

What will print_details(name="Alice", age=30) output?

Selecione a resposta correta

Given the function definition below, which call is valid?

Selecione a resposta correta

Tudo estava claro?

Seção 2. Capítulo 4
some-alt