defExpert Playground

Defines a new function or method

Python Playground
Output
Click "Run" to execute your code

Functions are first-class objects with rich metadata: __code__ holds the compiled bytecode, __annotations__ holds type hints, and __doc__ holds the docstring. The dis module shows the bytecode instructions.

Challenge

Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?