Lesson 07: Talking to Your Program: input()

This is a simulation of input() — in IDLE, input() waits for you to type in the Shell; here, type your answers in the boxes and press Run. A browser page cannot wait for typing the way IDLE does, so the answers are collected first and then fed to the program. Run the same code in IDLE to see the real thing.

In the lesson, the program asks for your name and your age, converts the age to a number with int(), and prints a greeting and your age in 10 years. Change the answers and run again.




Try this: Change the age to twelve and press Run again — int() cannot convert it, and you will see the ValueError from the lesson.

The code that runs


Output

Press Run to see the output here.