8.1 Input in Python

How do we get information into the program? If you want the user to type something, you can use the input() function. Here are a couple examples:

Example # 1

Example #2

By default, input() is a string. If we want to input an integer or float, we need to convert them:

We can use the input in calculations:

You can also accept floats: