> For the complete documentation index, see [llms.txt](https://www.pythonclassroom.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pythonclassroom.com/output.md).

# Output

{% embed url="<https://docs.google.com/presentation/d/1KNFs4MhlXDs9vo8WI9LdDUhvhVnkwZ8tdlMR-AesKcI/edit?usp=sharing>" %}

## print function

The print function prints output to the console.

{% code title="hello.py" %}

```python
print("Hello World!")
```

{% endcode %}

{% code title="Terminal" %}

```bash
$ python hello.py 

```

{% endcode %}

{% code title="Output" %}

```
Hello World!
```

{% endcode %}

{% hint style="info" %}
Objects are automatically converted to string representations for printing.
{% endhint %}

Reference: <https://docs.python.org/3/library/functions.html#print>

## String Concatenation and Formatting

String concatenation is the operation of joining character strings.  In Python, there are several ways to concatenation strings. &#x20;

### Comma

```python
print("hello","world")
```

### String Concatenation

```python
print("hello" + " " + "world")
```

### String Interpolation

```python
print("{0} {1}".format("hello","world"))
```

### Format Literals&#x20;

Python 3.6 introduced format literals, with a more elegant syntax (less redundancy).

```python
greeting = "hello"
who = "humans"
print(f"{greeting} {who}")
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://www.pythonclassroom.com/output.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
