Lesson goal: Getting input from the keyboard

Previous: Random numbers | Home | Next: Getting clicks from the mouse

Having a computer program interact with the person using it is extremely important. By this we mean having a program take some action in direct response to something you may type into it. For the programming lessons here, we'll use the keyboard as our primary interaction device. In other words, we'll learn here how to read input from the keyboard, then use that input in your programs.

To read text from the keyboard, we'll use a pre-defined function called input(). It works like this:
variable=input()
Move the mouse over a dotted box for more information.

Now you try. Try using input() to read something from the keyboard, and into a variable.

Type your code here:


See your results here: