# REPL

<mark style="color:$primary;">Python comes with a full-featured interactive command-line REPL (read-eval-print loop) built into the</mark> <mark style="color:$primary;"></mark><mark style="color:$primary;">`python`</mark><mark style="color:$primary;">executable. In addition to allowing quick and easy evaluation of Python statements, it has a searchable history, tab-completion, many helpful keybindings, and dedicated help</mark> <mark style="color:$primary;"></mark><mark style="color:$primary;">`?`</mark> <mark style="color:$primary;"></mark><mark style="color:$primary;">and shell modes</mark> <mark style="color:$primary;"></mark><mark style="color:$primary;">`;`</mark><mark style="color:$primary;">.</mark>

This page provides examples of using REPL on the command line

## Python REPL Example (local)

* Type `python` in terminal to launch REPL

<figure><img src="/files/nW3aMCWSxN6TDyh9Yt7v" alt="Terminal screen showing Python launched. >>> print(&#x22;hello world!&#x22;),  output = hello world!;  >>> word = &#x22;test&#x22; >>> print(word), output = test; >>> type(word), output = <class &#x27;str&#x27;>; >>> len(word), output = 4; >>> exit()"><figcaption></figcaption></figure>

## Python REPL Help Pages (local)

* Type "`help`" to enter help pages within REPL
* Type a function from Python to read help pages (ex:`print`)
* Press `q` to quit

<figure><img src="/files/8ZWqsQLqGzoMHrfmmCgn" alt="Terminal screen with Python launched. >>> help(print)"><figcaption></figcaption></figure>

<figure><img src="/files/BDcq7q778AUJEd3tUSUS" alt="Terminal screen with python launched. Output of >>>help(print) = Help on print function"><figcaption></figcaption></figure>

## Resources

* Real Python: [The Python Standard REPL: Try Out Code and Ideas Quickly](https://realpython.com/python-repl/)


---

# 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.bcbi.brown.edu/codiac-for-health/computing/python/repl.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.
