Start free

GCSE · 4 exercises

Python printing

print() shows text on the screen, one line each time it is called. Text goes in quotes; numbers don't need them.

Give print() several values and it puts a space between them. sep= changes what goes between, end= what comes after (a new line, unless you say otherwise).

print("Hello")
print(3, 2, 1, sep=" -> ")
print("Same", end=" ")
print("line")

Watch for: The output must match exactly: a missing space, a capital letter or a full stop makes a test fail. Copy the expected line carefully.

Exercises

  1. Hello, World!Write your first program: print the text Hello, World!Novice
  2. Three linesPrint the words Python, is and fun, each on its own line.Novice
  3. A box of starsPrint this box made of stars.Novice
  4. Countdown with arrowsPrint the numbers 3, 2, 1 and the word Go!Novice
Start with “Hello, World!”