2.3.2

Input

Test yourself

Input

There must be some mechanism for the user to input data to the computer.

Illustrative background for What data can I input?Illustrative background for What data can I input? ?? "content

What data can I input?

  • Data can be input from any device connected to the computer.
  • The keyboard is the most common data input device for command line programs.
  • We will only look at keyboard input in this course.
Illustrative background for The input functionIllustrative background for The input function ?? "content

The input function

  • Python has a built in function (command) which allows us to take keyboard input.
  • We can use the code: input(“Prompt”) to take the input.
  • We can write any text for the “Prompt”, which will be displayed to the user before they type their response.
Illustrative background for Data type of inputIllustrative background for Data type of input ?? "content

Data type of input

  • When data is entered from the keyboard, it is automatically a ‘string’.
  • A string is a sequence of character inputs from the keyboard, for example ‘Hello’.

Jump to other topics

1Computational Thinking & Algorithms

2Programming

3Hardware & Software

4Data

5The Internet

6Online Safety & Security

Go student ad image

Unlock your full potential with GoStudent tutoring

  • Affordable 1:1 tutoring from the comfort of your home

  • Tutors are matched to your specific learning needs

  • 30+ school subjects covered

Book a free trial lesson