# Functions

## Mixing positional and keyword arguments

You can mix both fashions if you want - there is only one unbreakable rule: you have to put positional arguments before keyword arguments.

## Parametrized functions - more details

It happens at times that a particular parameter's values are in use more often than others. Such arguments may have their default (predefined) values taken into consideration when their corresponding arguments have been omitted.

They say that the most popular English last name is Smith. Let's try to take this into account.

The default parameter's value is set using clear and pictorial syntax:

```
def introduction(first_name, last_name="Smith"):
    print("Hello, my name is", first_name, last_name)
```

## What happens when Python encounters an invocation like this one below?

```python
function_name(argument)
```

Let's see:

* First, Python checks if the name specified is legal (it browses its internal data in order to find an existing function of the name; if this search fails, Python aborts the code);
* second, Python checks if the function's requirements for the number of arguments allows you to invoke the function in this way (e.g., if a specific function demands exactly two arguments, any invocation delivering only one argument will be considered erroneous, and will abort the code's execution);
* third, Python leaves your code for a moment and jumps into the function you want to invoke; of course, it takes your argument(s) too and passes it/them to the function;
* fourth, the function executes its code, causes the desired effect (if any), evaluates the desired result(s) (if any) and finishes its task; finally, Python returns to your code (to the place just after the invocation) and resumes its execution.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.arkannis.net/programming/python/classic-python/functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
