The Theory:

Write a program that asks for input

Input: Write a program that asks for input

In order to interact with a user or the outside world, almost every computer program needs to be able to accept input data. Inputs could be pressing a button, scanning in an image, loading a file. Most often though, input is detecting what the user types or presses.

Input means receiving data in to the computer from a user, sensor or other device.

Data is the stuff that gets sent in to a computer: it can represent text, pictures, sound or whatever your program deals with. When the computer has processed it into something useful, it becomes information.

We’re going to learn how to write python code that will ask a question for the user to input their answer on screen.

Key point: To ask a question or prompt the user for input in python, you use the input function.

On the next page you’ll get some code examples that you can try out for yourself.

Page 1: Intro

Page 2: The theory: learn what you need to know as fast as possible.

Page 3: Try it: try out and adapt some working python code snippets.

Page 4: Debug it: Learn how to find and fix common mistakes.

Page 5: Extend it: Choose a project idea to use your newfound python skills.