Test your knowledge with free interactive questions on Seneca — used by over 10 million students.

Whitespace

Whitespace is key to Python, since it is used to separate blocks of code.

Indentation

Indentation

  • Indentation is necessary in Python to control program flow.
  • Even in languages where it is optional, it is best practice since it makes code more readable.
Blank lines

Blank lines

  • Sometimes blank lines can be used to make code more readable.
  • In Python, the guidelines are:
    • Subroutines should be separated by a blank line.
    • Blank lines can be used sparingly in subroutines to show sections of the subroutine.
    • Other lines of code should not have blank space around them.
Jump to other topics
1

Computational Thinking & Algorithms

2

Programming

3

Hardware & Software

4

Data

5

The Internet

6

Online Safety & Security

Practice questions on Whitespace

Can you answer these? Test yourself with free interactive practice on Seneca — used by over 10 million students.

  1. 1
  2. 2
Answer all questions on Whitespace

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium