In this module, you will learn the concepts of input, processing and output in Python programming. Input is data that the program receives. When a program receives data, it usually processes it by performing some operations with it. The result of the operation is sent out as output. Let's get started!


Lesson 1 of 7: Overview

Learning Outcome


3 step process

Computer programs typically perform the 3 step process to read input typed by the user, perform an operation on that input and send out the results of the operation as output. The example program calculates the gross monthly pay given the working hours and the hourly pay rate.

3 Step Process.gif

  1. The program first reads the hours worked and hourly pay rate from the user, and stores the data in variables so it can be used later.
  2. The program compute the gross pay by multiplying the hours worked and hourly pay rate.  The calculated value is again stored in a variable.
  3. Finally, the program output the gross pay.

The program uses input devices such as keyboard, mouse to read data from the user.  The processed data is normally displayed as an output on the computer screen.

In most cases the input stems from the keyboard.  Python provides the input() function that reads data entered at the keyboard, and returns it as a string value back to the program.


Lesson 2 of 7: Input from Keyboard

The input() function