> For the complete documentation index, see [llms.txt](https://learnpython.strivemath.com/p5-python-web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learnpython.strivemath.com/p5-python-web/reference/built-in-variables/keyboard.md).

# Keyboard

## `key`

This built-in variable stores the **value** of the **most recently pressed key.** For example, if the user presses **'m'**, then **'b'** :&#x20;

**key** will be equal to **'b'**&#x20;

## `keyIsPressed`

&#x20;This built-in variable has the value `True` **if any key is pressed at the moment**. It has the value `False` otherwise. (Boolean datatype)

## `keyCode`

This built-in variable stores the **key code** of the **last key** that was pressed.

Here are some **built-in constants** that can be used

```python
ENTER = 13
SHIFT = 16
UP_ARROW = 38
DOWN_ARROW = 40
LEFT_ARROW = 37
RIGHT_ARROW = 39
```

In general, you can search the web for: `key code of ###` or look at [this website](https://www.toptal.com/developers/keycode).

{% hint style="info" %}
Find these documents helpful? Let the people who made them help your child learn to code at [**Strivemath**](https://www.strivemath.com/)<mark style="color:blue;">**!**</mark>

We'd love to hear your Feedback/Comments [here](https://docs.google.com/forms/d/e/1FAIpQLSeqorBAGTya-YBRI-VFjJxtgQtCz3ucGDI96K96sNyuaGuvdw/viewform?usp=sf_link).
{% endhint %}


---

# 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:

```
GET https://learnpython.strivemath.com/p5-python-web/reference/built-in-variables/keyboard.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.
