> Source URL: /resources/input.guide
# Input

The `input()` function asks the user to type something and returns what they typed as a string.

## Example

```python
name = input("What is your name? ")
print("Hello, " + name)
```

**When run:**

```
What is your name? Alex
Hello, Alex
```

## How It Works

1. Python displays the prompt text (the string inside the parentheses)
2. The program pauses and waits for the user to type something
3. When the user presses Enter, their input is returned as a string

## Store Input in a Variable

Always store user input in a variable so you can use it later:

```python
city = input("Where are you from? ")
food = input("What's your favorite food? ")
print(city + " has great " + food)
```

## Input Always Returns a String

Even if the user types a number, `input()` returns it as a string:

```python
age = input("Enter your age: ")
print(type(age))  # <class 'str'>
```

To use the input as a number, convert it:

```python
age = input("Enter your age: ")
age = int(age)          # convert to integer
print(age + 1)          # now math works
```

```python
price = input("Enter price: ")
price = float(price)    # convert to decimal
print(price * 1.08)     # calculate with tax
```

_See the [Data Types](data-types.guide.md) guide for more on type conversion._

## Empty Prompts

You can use an empty string if you don't want a prompt:

```python
print("Enter your name:")
name = input("")
```

But it's usually clearer to include the prompt directly:

```python
name = input("Enter your name: ")
```

_Tip: add a space at the end of your prompt so the user's typing doesn't bump right against your text._


---

## Backlinks

The following sources link to this document:

- [Input Guide](/resources/resources.index.llm.md)
- [>ref: █████████](/unit-1/projects/02-you-dot-py/you-dot-py.project.llm.md)
- [I/O Procedures](/unit-2/projects/01-internal-review/01-internal-review.ticket.llm.md)
- [I/O Procedures](/unit-2/projects/01-internal-review/oracle-handbook.guide.llm.md)
