Revise Computingrevisecomputing.co.uk
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates

Knowledge organisers / Output and Sequence

Basic print / output

All topicsPractise exam questions
Knowledge organiser

Output and Sequence

301.1a

Use print statements to display text or data.

What you need to know

The print() function is the most fundamental way to produce output in Python. It sends text, numbers, or the value of variables to the console so the user can see results. Every program that communicates with a user will use output.

Key points

  • print() outputs text to the console
  • Strings must be wrapped in quotes (single or double)
  • Multiple items can be separated with commas
  • print() adds a newline at the end by default
  • Use end='' to prevent the automatic newline

Code examples

Printing a simple string
python
print("Hello, world!")
# Output: Hello, world!
Printing multiple values
python
name = "Alice"
age = 15
print("Name:", name, "Age:", age)
# Output: Name: Alice Age: 15