Seneca

Output

Computer Science: KS3, topic 2.3.3

Output

Output is necessary so that we can see the results of programs.

Why do we need outputs?

Why do we need outputs?

  • Outputs are important.
  • Outputs communicate the result of a program to the user.
  • Outputs are usually delivered as text onto the screen.
The print function

The print function

  • The output function in Python is called ‘print’.
  • The output function ‘prints’ data onto the screen.
  • E.g. print(“Hello, world!”) would output the text “Hello, World!”.
What data can be outputted?

What data can be outputted?

  • Output data must be a string before we can print it.
  • We may want to display data that is not a string.
  • We must first cast the data to a string.

Test yourself on Output

  • How are outputs usually delivered to a user?

  • Why are output statements used?

  • A program calculates a total but leaves out its print statement. What would appear on the screen?

Practise this topic for free