Skip to content
CodeWiki
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
Search
⌘K
English
English
Chinese
Practice
Paths
Tracks
Cheatsheets
Playground
Glossary
AI era
English
English
Chinese
Practice
/
Quiz
/
Python
/
*args and **kwargs
What happens when capture is defined as def capture(**metadata) and called as capture(**{…
from *args and **kwargs
Python 3.14
advanced
3 min
What happens when capture is defined as def capture(**metadata) and called as capture(**{"content-type": "json"})?
metadata becomes {'content-type': 'json'} because the mapping key is a string.
It raises SyntaxError because the key contains a hyphen.
It raises TypeError because every keyword key must be a valid identifier.
metadata becomes {'content': 'json'} after normalization.
Check
Ask AI about this kata
Report an error
previous kata
In def route(path, /, version, *parts, strict=True, **metadata), which classification is …
Quiz
next kata
What does this program print?
Predict the output
A new version is available
Reload