# Input

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

## Introduction

Typically, programs take input from a user, process this input and give the user output.

![](/files/-LVZftDEj76s8O5GjyDD)

## input function

The input() function takes input from your console. It reads the input and converts it to a string.

## Variable Roles

![](/files/-Ld0udJ_c-fcYtF88LSU)

## Changing the data type of the input

| Function | Converts               | Example                                  |
| -------- | ---------------------- | ---------------------------------------- |
| int()    | converts to an integer | num = int(input("Give me an integer: ")) |
| float()  | converts to a float    | num = float(input("Give me a float: "))  |

{% hint style="info" %}
When using the input function, think about about what data type you want.
{% endhint %}

```python
name = input("What's your name? ")
num = int(input("Give me a number: "))
money = float(input("How much money do you have? "))
```

{% hint style="danger" %}
A common mistake is not matching the number of open parenthesis and closed parenthesis.
{% endhint %}

## Example

Write a program that prompts for two numbers. Print the sum, difference, product, and quotient of those numbers.  In addition, print the result of integer division and the modulus operator of those numbers.

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

```python
num1 = int(input("Number 1: "))
num2 = int(input("Number 2: "))
print("Sum:", num1 + num2)
print("Difference:", num1 - num2)
print("Product:", num1 * num2)
print("Quotient:", num1 / num2)
print("Integer Division:", num1 // num2)
print("The Remainder of num1 divided by num2:", num1 % num2) 
```

{% endcode %}


---

# 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://www.pythonclassroom.com/input.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.
