Input is a key function when programming. Do you remember the pokémon picture from the variables page?

Untitled

We need to be able to take data from users. This enables us to write programs with different outcomes.

Example input

name = input("What's your name hero?")

As you can see from the example above, we need to start the input statement using a variable. Then we use the input keyword function.

Untitled

<aside> 💡 The default datatype for an input is a string. So anything that is saved in the variable after the input will be saved in quotes " "

We can change this ... 👀👇

</aside>

Example input for an integer

age = int(input("How old are you?"))

Example input for a float

price = float(input("How much for that doggie in the window?"))

Untitled

Untitled

Here you can see this in action above. 💡 Also notice the function I haven’t used before type() which returns the datatype of an object